Results 1 to 4 of 4

Thread: startup

  1. #1
    Join Date
    Apr 2004
    Posts
    100

    Unanswered: startup

    Hello,

    I am using a backend database on a network connection. And I have about 5 frontend databases which are linked to the backend database.
    What I am looking for now, is a way to handle errors that might occur at startup, i.e. if one table link is corrupted.
    Could anyone provide me instructions how to manage that, or maybe is there already ADO code for that purpose?
    Thanks a lot in advance.
    Regards Proximus

  2. #2
    Join Date
    Jan 2004
    Location
    Islamabad, Pakistan
    Posts
    97
    one of the most widely used methond is to refresh your links to the backend database before the front end is fully loaded on the workstation.

    I mean at the start of the frontend you should write a routine or module to refresh your links and then display the startup form. But on slow networks or for larger tables in multiuser environment it is a time consuming process that might cause a unnecessasory and annoying delay for the users.

    The other method is to remove your links at the close of your front end and then re-create the fresh links on the start of the frontend every time which is much faster method but is a bit tricky sometimes for some.

    now it depends which might be your preference.

    Saqib

  3. #3
    Join Date
    Apr 2004
    Posts
    100
    hmm. I think I would favour your first method.
    How can I refresh the links?
    Thanks for your help!
    Regards Proximus

  4. #4
    Join Date
    Jan 2004
    Location
    Islamabad, Pakistan
    Posts
    97
    Here is the sample code which I use normally to link, unlink and refresh links in my databases...

    you can use these functions with database file path as the parameter for linkdatabase() and refreshlinks()

    eg. LinkDatabase "C:\MyDocuments\mydatabase.mdb"

    **************

    Sub RemoveLinks()
    Dim tdf As TableDef
    For Each tdf In CurrentDb.TableDefs
    If Left(tdf.Name, 4) <> "MSys" And (tdf.Attributes And dbAttachedTable) = dbAttachedTable Then
    CurrentDb.TableDefs.Delete tdf.Name
    End If
    Next tdf
    Set tdf = Nothing
    End Sub

    Sub LinkDatabase(StrDBPath As String)
    Dim dbs As Database
    Dim tdf As TableDef
    Set dbs = OpenDatabase(StrDBPath)
    For Each tdf In dbs.TableDefs
    If Left(tdf.Name, 4) <> "MSys" Then
    DoCmd.TransferDatabase acLink, "Microsoft Access", Trim(StrDBPath), acTable, tdf.Name, tdf.Name
    SysCmd acSysCmdSetStatus, "Processing table [" & tdf.Name & "]..."
    End If
    Next tdf
    SysCmd acSysCmdClearStatus
    Set dbs = Nothing
    Set tdf = Nothing
    End Sub

    Sub RefreshLinks(StrDBPath As String)
    Dim tdf As TableDef
    For Each tdf In CurrentDb.TableDefs
    If (tdf.Attributes And dbAttachedTable) = dbAttachedTable Then
    tdf.Connect = "; Database = " & StrDBPath
    SysCmd acSysCmdSetStatus, "Processing table [" & tdf.Name & "]..."
    tdf.RefreshLink
    End If
    Next tdf
    Set tdf = Nothing
    SysCmd acSysCmdClearStatus
    End Sub

Posting Permissions

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