I need to find code that will create a reference to another Access DB which contains generic code used throughout several other company applications. All of our user's applications are shared in a drive created specifically for them. Here is an idea of what I am trying to use, but it doesn't seem to work on a properly. (This code is called with an AutoExec Macro):
(Also, just a note, the DIOS database contains the SetUpMenu Function)
Public Function SalesAppStartUp()
On Error GoTo Err_Handler
Dim ref As Reference
Dim strDBPath As String
Dim strUser As String
strDBPath = "\\genesys08\users\" & fOSUserName & "\databases\DIOS.accdb"
MsgBox strDBPath
'CHECK FOR MISSING REFERENCES, IF MISSING REMOVE REFERENCE
For Each ref In References
If ref.IsBroken Then
References.Remove ref
MsgBox "A Missing reference has been detected and removed", vbOKOnly
End If
Next ref
'ADD DIOS REFERENCE IF IT DOESN'T EXIST
AddRef:
For Each ref In References
If ref.NAME = "DIOS" Then
GoTo MenuSetup
End If
Next
References.AddFromFile (strDBPath)
'SET UP MAIN DATABASE MENUS USING FUNCTION IN DIOS
MenuSetup:
SetupMenu
GoTo Exit_Function
Exit_Function:
Set ref = Nothing
Exit Function
Err_Handler:
If Err.Number = 29060 Then
MsgBox strDBPath & " was not found. Please Notify Systems Dept."
Resume Exit_Function
End If
MsgBox Err & ": " & Err.Description
Resume Exit_Function
End Function
Start Free Trial