G
Guest
Because I have a number of projects for which data needs to be kept separate
I have created a split database with the intention that I could copy the
created back end to create a blank set of tables and when I had a new project
that I could take the blank tables and create a copy with an appropriate
name, ie projectxtables and then set up a button on a switchboard to select
the new back end tables. This would lead to a switchboard with a series of
buttons calling various project tables. All back end tables have the same
structure.
I came across the following when trying to find help but it gives me a -
Run-time error '3265' Item not found in collection - when I try to run it. I
obviously changed the directory and file name to the back end I created (back
end created by copying back end file and giving new name as described above).
The path to the backend table is stored in the linked
table's Connect property. See Help for details.
If the backend is a Jet database (MDB, MDE, etc) file the
code would look like:
Dim db As DAO.database
Dim tdf As DAO.TableDef
Dim strPath As String
strPath = "C:\test\testdb.mdb"
Set db = CurrentDb()
Set tdf = db.TableDefs!linkedtable
tdf.Connect = ";DATABASE=" & strPath
tdf.RefreshLink
Set tdf = Nothing
Set db = Nothing
--
Marsh
MVP [MS Access]"
Surely what I am trying to do is not unusual but as a beginner in access I
have not yet the knowledge to do it.
I have created a split database with the intention that I could copy the
created back end to create a blank set of tables and when I had a new project
that I could take the blank tables and create a copy with an appropriate
name, ie projectxtables and then set up a button on a switchboard to select
the new back end tables. This would lead to a switchboard with a series of
buttons calling various project tables. All back end tables have the same
structure.
I came across the following when trying to find help but it gives me a -
Run-time error '3265' Item not found in collection - when I try to run it. I
obviously changed the directory and file name to the back end I created (back
end created by copying back end file and giving new name as described above).
Josh said:I would like to change the absolute path of a linked table in code behind a
button.
I have a linked table named "TestTable" and would like to refresh the link
to C:\test\testdb.mdb
The path to the backend table is stored in the linked
table's Connect property. See Help for details.
If the backend is a Jet database (MDB, MDE, etc) file the
code would look like:
Dim db As DAO.database
Dim tdf As DAO.TableDef
Dim strPath As String
strPath = "C:\test\testdb.mdb"
Set db = CurrentDb()
Set tdf = db.TableDefs!linkedtable
tdf.Connect = ";DATABASE=" & strPath
tdf.RefreshLink
Set tdf = Nothing
Set db = Nothing
--
Marsh
MVP [MS Access]"
Surely what I am trying to do is not unusual but as a beginner in access I
have not yet the knowledge to do it.