Linked Table Manager Macro

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andyk

    #1

    Linked Table Manager Macro

    I have a database on a network drive, that needs to be used by various
    people throughout the state on their laptops when their laptops are not
    connected to the network. What I have set up so far is a main database
    where the tables are held. I also have a database where all the
    queries, macros, and forms are held. This second database contains a
    link to the tables in the first database. When someone needs to use the
    database, they will be instructed to click a button, which runs a query
    to create a table with the information they need. They can then copy
    this database to their laptops for use. later, it is my intent to have
    queries write the data back to the main database.

    Problem: In my company, the network drive is called something different
    for each office in the state. Drive 'N', drive 'S', etc. So, before the
    people run the query they will need to run the Linked Table manager to
    direct Access to the correct location of the main database.

    I have found some VBA coding, but when ran actually creates a new link.
    I don't want this, as I have the link created and use it in various
    queries (so the name can't change by adding a '1' to the end). I am a
    VBA newbie (so please be kind). The coding I have found is:

    Sub GetLink()
    On Error GoTo ErrGetLink
    DoCmd.RunComman d acCmdLinkTables
    Exit Sub
    ErrGetLink:
    Select Case Err
    Case 2046
    'Command not available
    MsgBox "Link Table is not available at this time.", vbCritical,
    "Not Available "

    Case 2501
    'Cancel selected in dialog box - do nothing
    Case Else
    MsgBox Err.Number & ":-" & vbCrLf & Err.Description
    End Select
    End Sub


    I don't know what any of this means. Also, when I put this in a macro
    and try a 'runcode' command, I can't get this to work. I am able to
    find my code when I click on the 'build' function, but it won't let me
    select it.

    I would appreciate any help you can give on this. Thank you.

Working...