I have an Access 2016 application that gets distributed to many users who are not sophisticated users. They usually have to install the MS Runtime for Access. Despite clear directions, too many users still find that the application will not open. It appears that early bound objects are not present on the system. With bound objects not present no code ever loads or runs, so it is not even possible to give a good error message.
I am now attempting to write a small program in which all the objects needed by the application are late bound, thus being able to say which modules are missing, if any. What I am finding though is that my method for detection is failing even when I KNOW the object is present. The code below is an example of one test for a required object. This test always fails and I cannot figure out why. I have about 7 of these. Three seem to work correctly, but the others do not. Is there some different way I should be coding the "CreateObject"?
Private Sub btnOffice_Click()
'Office FileDialog MSO.DLL Microsoft Office 16.0 Object Library
Dim obj As Object
On Error GoTo xyzzy
Set obj = CreateObject("Office.FileDialog")
lblOffice.Caption = "Office module present"
Exit Sub
xyzzy:
lblOffice.Caption = officeWarning
MsgBox Err.Description
End Sub
You're trying to detect broken References. Here's a procedure to check for and report broken references:
Sub CheckReferences()
Dim ref As Reference
For Each ref In References
If ref.IsBroken Then
MsgBox "Broken reference detected: " & vbCrLf & ref.Name & vbCrLf & ref.FullPath, vbOKOnly + vbCritical, "Broken Reference"
End If
Next ref
End Sub