C
Carl Rapson
I'm trying to set up a dynamic link to a table in another database, and I'm
having a problem. Here's the code I'm using to establish the link:
Dim tbl As DAO.TableDef
Dim db As DAO.Database
Set db = CurrentDb
Set tbl = db.CreateTableDef("Remote Table")
tbl.Connect = ";DATABASE=\\server\folder\Remote Database.mdb"
tbl.SourceTableName = "Remote Table"
db.TableDefs.Append tbl
... use the table here ...
db.TableDefs.Delete "Remote Table"
Set tbl = Nothing
Set db = Nothing
This will work once or twice, but at some point I get an error 3045 ("file
already in use") on the TableDefs.Append line. Sometimes I can clear the
problem by rebooting my computer, but that doesn't always work and I'm not
really sure how to clear it. I've also noticed that once I get the error,
the response from the table (when I open it, for example) is slower.
I can manually add the table through the New | Link Table wizard even after
getting the error 3045, but I would prefer not to leave the link in place
all the time. Any insights into what causes this error? Am I missing
something in my code? Any help would be greatly appreciated.
Carl Rapson
having a problem. Here's the code I'm using to establish the link:
Dim tbl As DAO.TableDef
Dim db As DAO.Database
Set db = CurrentDb
Set tbl = db.CreateTableDef("Remote Table")
tbl.Connect = ";DATABASE=\\server\folder\Remote Database.mdb"
tbl.SourceTableName = "Remote Table"
db.TableDefs.Append tbl
... use the table here ...
db.TableDefs.Delete "Remote Table"
Set tbl = Nothing
Set db = Nothing
This will work once or twice, but at some point I get an error 3045 ("file
already in use") on the TableDefs.Append line. Sometimes I can clear the
problem by rebooting my computer, but that doesn't always work and I'm not
really sure how to clear it. I've also noticed that once I get the error,
the response from the table (when I open it, for example) is slower.
I can manually add the table through the New | Link Table wizard even after
getting the error 3045, but I would prefer not to leave the link in place
all the time. Any insights into what causes this error? Am I missing
something in my code? Any help would be greatly appreciated.
Carl Rapson