Automation of Linking Tables

G

Gnerks

I have 8 Access databases that I need to link tables from into one basically
utility database. Is there an automated way to do this. It is somewhat odd
in that one of the databases has 3 tables, two have 2 tables and five have 1
table. the utility requires that the tables be linked in a specific format.
For example, I want tblLCOM from the database ATT All.mdb, then tblLCOM2MRS
from the database ATT 2 MRS.mdb, then tblLCOM3MRS from the database ATT 3
MRS.mdb, then back to ATT all.mdb for tblREPORTfields, back to ATT 2 MRS.mdb
for tblREPORTfields (which becomes tblREPORTfields1 in the utility database),
etc.

In essence, I am pulling tables, in different sequences from ATT ALL.mdb 3
times, from the 2 MRS.mdb and 3 MRS.mdb twice, then the rest are just one
table.

Is there a way to automate this process so that my user can merely click a
command button on the utility form and the tables will be linked into the
utility database?
 
A

Anthony

Hi I hope the following code will work for you.
Saji

Private Sub Command0_Click()
On Error GoTo Err:
DoCmd.TransferDatabase acLink, "Microsoft Access", "ATT All.mdb",
acTable, "tblLCOM", "tblLCOM"
DoCmd.TransferDatabase acLink, "Microsoft Access", "ATT 2 MRS.mdb",
acTable, "tblLCOM2MRS", "tblLCOM2MRS"
DoCmd.TransferDatabase acLink, "Microsoft Access", "ATT 3 MRS.mdb",
acTable, "tblLCOM3MRS", "tblLCOM3MRS"
' and so on
Exit Sub
Err:
If Err.Number = 3265 Then
Resume Next
ElseIf Err.Number = 3024 Then
MsgBox Err.Description
Else
MsgBox Err.Number & " " & Err.Description
End If

End Sub
 
G

Gnerks

Thank you will try this and see if I can get it to work for me. I appreciate
your quick response!
 

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

Top