Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Santa Maria, California, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    acCmdLinkTables (Access 2000)

    I want to link tables to my application using Vb. Help tells me that acCmdLinkTables is a method for the DoCmd.RunCommand, but I can not find the proper syntax for this statement to allow me to add the Names of the tables.
    Could someone please help?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: acCmdLinkTables (Access 2000)

    RunCommand acCmdLinkTables just invokes the interactive menu option.

    To link tables programmatically, you can use (at least) two methods:

    DoCmd.TransferDatabase acLink, "Microsoft Access", "C:MyDatabase.mdb", acTable, "SourceTableName", "TargetTableName"

    or

    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    ' Set reference to current database.
    Set dbs = CurrentDb
    ' Create new TableDef object
    Set tdf = dbs.CreateTableDef("TargetTable")
    ' Link to table in other database.
    tdf.Connect = "C:MyDatabase.mdb"
    tdf.SourceTableName = "SourceTable"
    ' Append to TableDefs collection.
    dbs.TableDefs.Append tdf
    ' Release object memory.
    Set tdf = Nothing
    Set dbs = Nothing

  3. #3
    New Lounger
    Join Date
    Aug 2002
    Location
    Santa Maria, California, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: acCmdLinkTables (Access 2000)

    Thank you Hans that was what I needed.
    Have a nice day.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •