Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link Question

Status
Not open for further replies.

MikeRBS

IS-IT--Management
Apr 15, 2004
81
GB
I have linked databases that may be on different drives, as with another post. I write a macro to link in tables but if the table exists already, then Access creates a table appended with a number. So I preface every link with a delete but then the macro stops if thew table doesn't exist, and greys out all options to continue. Is there any (macro) way of getting around this nonsense?
 
Don't insist with macros and play with VBA if you have to handle errors ...
For linked tables management you may take a look here:

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
As a matter of interest I saved the macro as a module then when I tried to run it it threw a Macros dialogue asking me for a macro...

This was the code:


'------------------------------------------------------------
' M_Link_D
' Links to InvPublic when USB is defined as D:
'------------------------------------------------------------
Function M_Link_D()
On Error GoTo M_Link_D_Err

' Remove current AppNew
DoCmd.DeleteObject acTable, "AppNew"
' Link AppNew
DoCmd.TransferDatabase acLink, "Microsoft Access", "d:\mobile\invpublic.mdb", acTable, "AppNew", "AppNew", False
' Remove current FHL
DoCmd.DeleteObject acTable, "FHL"
' Link AppNew
DoCmd.TransferDatabase acLink, "Microsoft Access", "d:\mobile\invpublic.mdb", acTable, "FHL", "FHL", False


M_Link_D_Exit:
Exit Function

M_Link_D_Err:
MsgBox Error$
Resume M_Link_D_Exit

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top