Linking Back-end data on flash memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database (fairly small, but very important to my business). Each time I change computers I have to manually update the links to the backend using the linked table manager. Is there a way to test for the disk error on opening and then refresh the links. Both files (front-end and back-end) exist on the same directory path in flash memory.
 
Ken said:
I have a database (fairly small, but very important to my business). Each time I change computers I have to manually update the links to the backend using the linked table manager. Is there a way to test for the disk error on opening and then refresh the links. Both files (front-end and back-end) exist on the same directory path in flash memory.


This article provides a general procedure to relink:
http://www.mvps.org/access/tables/tbl0009.htm

But, if the front and back ends are always in the same
directory, you can just grab the front end's path from
CurrentProject.Path (or parse it out of CurrentDb.Name in
older versions) and simply set each linked table's Connect
property:

Dim db As Database
Dim tdf As TableDef
Dim strPath As String
strPath = CurrentProject.Path
Set db = CurrentDb()
For Each tdf In db.TableDefs
If tdf.Connect <> "" Then
tdf.Connect = ";DATABASE=" & strPath & "\datafile.MDB"
tdf.RefreshLink
End If
Next tdf
Set tdf = Nothing
Set db = Nothing
 
How does one get the code to run on start up. I've tried creating a sub called AutoExec() and nothing occurs on start up. What am I doing wrong? I placed the sub AutoExec() in a module called AutoExec().

Thank you for your response. It works. Just need it to operate on start-up.
 
Ken Nicholas said:
How does one get the code to run on start up. I've tried creating a sub
called AutoExec() and nothing occurs on start up. What am I doing wrong? I
placed the sub AutoExec() in a module called AutoExec().
Thank you for your response. It works. Just need it to operate on start-up.

AutoExec needs to be a Macro. The macro can be made to do nothing more than
execute you module code however.
 
Back
Top