Relink tables without user intervention

Proditech Orion

Registered User.
Local time
Today, 05:11
Joined
Sep 28, 2006
Messages
15
Hello all,

1 - I'm creating a database splitted in two: The front end with forms, queries, reports, balbla; and a mdb where the actual data and tables are.
On the welcome form I have a code to read inside a INI file I created that reads where the DATA.mdb is. IF the DATA.MDB is not on place the INI file points it will give an error "File not found, contact the DBA, etc "and closes the database.

That part it's working perfectly.
The problem starts if the file exists but on a different location. I must relink all tables. I putted the following code on a button

====================
Sub P_GetLink()

On Error GoTo ErrGetLink

DoCmd.RunCommand acCmdLinkTables
Exit Sub

ErrGetLink:

Select Case Err
Case 2046
'Command not available
MsgBox "Link Table is not available at this time.", vbCritical, "Not Available"
Case 2501
Case Else
MsgBox Err.Number & ":-" & vbCrLf & Err.Description
End Select

End Sub
====================
It works... it calls the LINK Dialog box and I can select all table and relink them (First I had to use DoCmd.DeleteObject acTable, "TABLE" for all tables (one at the time). I needed this to avoid creating the links like customers1 instead of customers.

Is there any code you can help me with that the relink can be automatically. I mean, I dont want the users to see the dialog box. I dont want them to have to select ALL the tables. I would like to know (Since I have a variable from the INI file, remember?; with the location of the DATA.MDB) how I can code something to be automatically, if it's possible.

THANK YOU for your time

Prody
 
This is how I do it.

Create a directory somewhere and copy the 2 files.

Dave
 

Attachments

Dave,
wow.. this is fabulous... exacly (in terms of funcionality) what I want. Kind of complicated for me at my stage, but I will study it.

Many, many thx
 
You dont need the progress bar, but I found that some networks are very slow, and the splash screen appeared to "hang" or "lock-up", so at least you can see that there is progress.

Dave
 

Users who are viewing this thread

Back
Top Bottom