Jun 11, 2004 #1 bbarr Programmer Sep 15, 2003 51 US I'm using Access 2000. I'm trying to set a connection to another .mdb file and programmatically set links to all tables in that file. If the second .mdb file is "d2.mdb" and located in "C:\" then how do I access the TableDefs collection of this database?
I'm using Access 2000. I'm trying to set a connection to another .mdb file and programmatically set links to all tables in that file. If the second .mdb file is "d2.mdb" and located in "C:\" then how do I access the TableDefs collection of this database?
Jun 11, 2004 1 #2 glalsop Technical User Aug 9, 2003 435 US Try something like: Dim dbs as DAO.Database Dim tdf as DAO.Tabledef Set dbs = "C:\db2.mdb" For Each tdf In dbs.TableDefs ... Next tdf Set tdf = Nothing Set dbs = Nothing Good luck -Gary Upvote 0 Downvote
Try something like: Dim dbs as DAO.Database Dim tdf as DAO.Tabledef Set dbs = "C:\db2.mdb" For Each tdf In dbs.TableDefs ... Next tdf Set tdf = Nothing Set dbs = Nothing Good luck -Gary
Jun 11, 2004 Thread starter #3 bbarr Programmer Sep 15, 2003 51 US Thanks. However, I'm getting a type mismatch error. I have the path/name of the file set to a string variable (pName) and therefore rewrote Set dbs = "C:\db2.mdb" to Set dbs = pName and this is giving me the error. Upvote 0 Downvote
Thanks. However, I'm getting a type mismatch error. I have the path/name of the file set to a string variable (pName) and therefore rewrote Set dbs = "C:\db2.mdb" to Set dbs = pName and this is giving me the error.
Jun 11, 2004 Thread starter #4 bbarr Programmer Sep 15, 2003 51 US I found the answer ... looking at some related code. you have to use: Set dbs = OpenDatabase(pName) Upvote 0 Downvote
Jun 12, 2004 #5 glalsop Technical User Aug 9, 2003 435 US Glad you got it sorted out. -Gary Upvote 0 Downvote