Linked Table Manager (1 Viewer)

fenhow

Registered User.
Local time
Yesterday, 21:26
Joined
Jul 21, 2004
Messages
599
Hi

I have been searching for a simple and clean process to simply check my front end against the backend.

I have tried a few different solutions however i seem to have problems with them.

I was wondering if;

When the database opens and the BE is missing or has changed in addition to the default access error window the Linked Table Manager automaticlly opens? or a form would open that I could put this code on?

docmd.RunCommand acCmdLinkedTableManager

Any help would be greatly appreciated...

Fen How
 

Moniker

VBA Pro
Local time
Yesterday, 23:26
Joined
Dec 21, 2006
Messages
1,567
Error trap on trying to automatically relink.

It's DoCmd.TransferDatabase aclink,<further options here>

You may want to check to see if the DB you're trying to link to even exists first. You can use the FSO (File System Object) for this.

The generic order is:

1) Does the DB you're linking to even exist? (Use the FSO).
2) If it exists, let me test table 1. Does it return the error number for "cannot find table"? (Trap that error number. Errors 3011 and 3024 will most likely be involved.)
3) If it exists, relink.
4) If it doesn't exist, either write that table name to a different internal table (tblRelinkMe or something) so that you know which tables relinked properly and which ones didn't, or prompt for the new name/location.
5) Go to 2 until completed.

Tip: You can tell if a table is linked by looking at its Connect property. A NULL Value means it's a local table. Anything else means it's an external link. (There may be an easier way to do this.)

SAMPLE LINK TEST:

If IsNull(CurrentDb.TableDefs("YourTableName").Connect) Then
<It's a local table>
Else
<It's a linked table>
End If

I don't want to write it for you, but this should be enough information to get it done.
 

Users who are viewing this thread

Top Bottom