Linking Tables with mdb files(Access 2000) by means of connection information stored in a DSN

Microsoft Access
I have used the following code but it does not seem to work but hangs up at the point where the Dao is initialed. Help!!!! Public Sub pCreateLinkedTable() Dim strDSNName As String Dim strAppName As String Dim strDatabase As String Dim strUID As String Dim strPW As String Dim strRemoteTableName As String Dim strLocalTableName As String Dim strConnection As String Dim daoTableDef As Dao.Tabledef Dim strDatabase As Dao.TableDef Dim Lnk As Dao.TableDef strDSNName = "MyDSN" strAppName = "Microsoft Access 2000" strDatabase = "FinanceGBB" strUID = "bradlej" strPW = "paris1" strRemoteTableName = "FMOSAL" strLocalTableName = "FMOSAL" strConnection = "ODBC:" & _ "DSN=" & strDSN & ";" & _ "App=" & strAppName & ";" & _ "Database=" & strDatabase & ";" & _ "UID=" & strUID & ";" & _ "PWD=" & strPWD & ";" & _ "Table=" & strRemoteTableName MsgBox "Links have been connected" End Sub

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Abacus,

You should probably convert to ADO where you can.

Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • DaveInAZ
    Hi Abacus, We do our best to help but, like many people, you're not giving us enough information to work with. Saying "it doesn't work" doesn't tell us anything. What line of code fails? What error does it raise? What alternatives have you tried? What references have you set? What event is firing off this routine? I assume the code snippet you supplied is not the entire routine. For one thing, you have two tabledef variables, but you aren't using them. Until you instantiated them, and assign them properties, such as the connectionstring you're preparing, you haven't really done anything except initialize some variables. You also need to add those tabledefs to the the tabledefs collection. Microsoft has dozens of Knowledgebase articles on linking tables in Access. Have you tried looking at those? They also have a sample code database, called Solutions9.mdb, which, if it's like earlier versions, has working code that does EXACTLY what you're trying to do. It's available as a free download at You should be able to adapt that to your needs very quickly. Good luck.
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: