Linking Back-end data on flash memory

K

Ken Nicholas

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.
 
M

Marshall Barton

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
 
K

Ken Nicholas

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.
 
R

Rick Brandt

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top