Hi
Apologies in advance...my VBA/module knowledge is at an early stage!
I have successfully linked two SQL tables with a AutoExec macro, using the following vba code:
Unfortunately, this creates a duplicate of both table links everytime I load up the database. How do I go about ensuring that the link is only created once, and that the linked tables are removed on exit (despite multiple users logging in)?
Many thanks
Apologies in advance...my VBA/module knowledge is at an early stage!
I have successfully linked two SQL tables with a AutoExec macro, using the following vba code:
Code:
Public Function SQLlink()
DoCmd.TransferDatabase acLink, "ODBC Database", "ODBC;Driver=SQLServer};Server=servername;Database=databasename; Uid=username;Pwd=password", acTable, "sourcetable1", "destinationtable1"
DoCmd.TransferDatabase acLink, "ODBC Database", "ODBC;Driver={SQLServer};Server=servername;Database=databasename; Uid=username;Pwd=password", acTable, "sourcetable2", "destinationtable2"
End Function
Unfortunately, this creates a duplicate of both table links everytime I load up the database. How do I go about ensuring that the link is only created once, and that the linked tables are removed on exit (despite multiple users logging in)?
Many thanks
Last edited: