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