There was a thread previous about disconnecting from a file. The reply was to delete the linked table using :
dbasetempname.TableDefs.Delete Tablename
I've been using this and it seemed fine, until now.
I connect to a remote file's table via this code :
Set tdfLink = CurrentDb.CreateTableDef(NewTable)
tdfLink.Connect = ";DATABASE=" & FileLocation
tdfLink.SourceTableName = SourceTable
CurrentDb.TableDefs.Append tdfLink
and was disconnecting the table via :
CurrentDb.TableDefs.Delete LinkedTable
Now the file I connect to is a .mdb file created by some 3rd party software.
If I run this 3rd party software while my Access application is not running - no problem - as you'd expect.
If I run this 3rd party software while my Access application is running and I've connected to the tables - problem - 3rd party software throws a fit saying the file has been opened for exclusive use by another - as you'd expect.
If I run this 3rd party software while my Access application is running and I've connected and then disconnected (using the delete table method) - 3rd party software throws a fit.
So I conclude that deleting the table doesn't actually disconnect you from the remote file.
The question is how do you disconnect from a file and undo the
tdfLink.Connect = ";DATABASE=" & FileLocation
as surely this is the only place a link to the table above is created?
Thanks,
Shaun
----------------
Shaun McLean
dbasetempname.TableDefs.Delete Tablename
I've been using this and it seemed fine, until now.
I connect to a remote file's table via this code :
Set tdfLink = CurrentDb.CreateTableDef(NewTable)
tdfLink.Connect = ";DATABASE=" & FileLocation
tdfLink.SourceTableName = SourceTable
CurrentDb.TableDefs.Append tdfLink
and was disconnecting the table via :
CurrentDb.TableDefs.Delete LinkedTable
Now the file I connect to is a .mdb file created by some 3rd party software.
If I run this 3rd party software while my Access application is not running - no problem - as you'd expect.
If I run this 3rd party software while my Access application is running and I've connected to the tables - problem - 3rd party software throws a fit saying the file has been opened for exclusive use by another - as you'd expect.
If I run this 3rd party software while my Access application is running and I've connected and then disconnected (using the delete table method) - 3rd party software throws a fit.
So I conclude that deleting the table doesn't actually disconnect you from the remote file.
The question is how do you disconnect from a file and undo the
tdfLink.Connect = ";DATABASE=" & FileLocation
as surely this is the only place a link to the table above is created?
Thanks,
Shaun
----------------
Shaun McLean