Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Linked table manager on error? (2003)

    Hello my dear friends,

    In my database I want to check right away if all linked tables are linked correctly. If not, the linked table manager (or a form in the same purpose) should be opened to link all tables to the right positions.

    When I rename my table-backend for testing purposes I get the Error 3044 right away when I start up the database (cuz I have a DLookup in the startup form). Now I tried several approaches such as On Error DoCmd.COmmand.accCmdLinkedTable Manager and so on - nothing worked.

    Maybe you guys can present me a solution?!?

    Thanks
    Dennis

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

    Re: Open Linked table manager on error? (2003)

    Use another form as startup form and test the links there. The Solutions9.mdb sample database from Microsoft Access 2000: Building Applications with Forms and Reports, Sample Applications Download shows how to do this.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Linked table manager on error? (2003)

    Hmm yeah it's in tehre but with a lot of code. I thought of something smaller.

    My idea goes as far as this: (no real code, just thought process)

    If Error 3044 On DLookup(Something in some table) Goto Error
    Else Goto NoError

    :Error
    Msg "Linked tables not found"
    DoCmd.Command acCmdLinkedTableManager

    :NoError
    Continue

    I hope you get what I mean. The Microsoft approach just seems a lil bit too much for my needs.

    Dennis

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

    Re: Open Linked table manager on error? (2003)

    You could use something like this, where tblLinked is a linked table:

    Private Sub Form_Load()
    Dim lngDummy As Long

    On Error GoTo Err_Handler
    lngDummy = DCount("*", "tblLinked")
    Exit Sub

    Err_Handler:
    MsgBox "Please relink the tables", vbExclamation
    RunCommand acCmdLinkedTableManager
    End Sub

    Note that it's RunCommand, not Command, and you don't need to prefix it with DoCmd.

  5. #5
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Linked table manager on error? (2003)

    Man, that works perfect! Thanks alot.

    Good that I didn't have to implement that huge solution by microsoft [img]/forums/images/smilies/smile.gif[/img]

    Dennis

Posting Permissions

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