Refresh library references (Error 3075) through VBA (1 Viewer)

ForcedToUseIt

Registered User.
Local time
Today, 04:24
Joined
Jul 25, 2004
Messages
34
Hi all,

Does any one know how to refresh library references through VBA?
I found this code some time ago (cant remember where, sorry), but it does not seem to do the job. Please have a look and see if you can get this code to work, cause I have not been successful.
I tried to check for error 3075 and if it came up, then I would run the FixUpRefs subroutine. This error comes sometimes up when I open the application (Front End) on a new computer which has not an updated version of Office.

Btw, I am using Access 2003 Front End and Microsoft SQL server 2000 Back end if it matters.

Code:
Sub FixUpRefs()
    Dim loRef As Access.Reference
    Dim intCount As Integer
    Dim intX As Integer
    Dim blnBroke As Boolean
    Dim strPath As String

    On Error Resume Next

    'Count the number of references in the database
    intCount = Access.References.Count

    'Loop through each reference in the database
    'and determine if the reference is broken.
    'If it is broken, remove the Reference and add it back.
    For intX = intCount To 1 Step -1
      Set loRef = Access.References(intX)
      With loRef
        blnBroke = .IsBroken
        If blnBroke = True Or Err <> 0 Then
          strPath = .FullPath
          MsgBox "Reference problem: " & strPath
          With Access.References
            .Remove loRef
            .AddFromFile strPath
          End With
        End If
       End With
    Next

  Set loRef = Nothing

  ' Call a hidden SysCmd to automatically compile/save all modules.
  Call SysCmd(504, 16483)
End Sub
 

Surjer

Registered User.
Local time
Today, 05:24
Joined
Sep 17, 2001
Messages
232
I cant reproduce any problem....

Any more specifics to re-create the problem?
 

Users who are viewing this thread

Top Bottom