Check library references via VBA

D

Dave the wave

I would like to know if I can use VBA in Access to check for library
references on the local machine, and then add any if necessary? If anyone
knows any sites or helpful links, I would be very grateful.
Thanks.
 
D

Douglas J. Steele

You can look at the References collection. For example, the following (from
the Help file) will show you all of the existing references (assuming none
are broken):

Sub ReferenceProperties()
Dim ref As Reference

' Enumerate through References collection.
For Each ref In References
' Check IsBroken property.
If ref.IsBroken = False Then
Debug.Print "Name: ", ref.Name
Debug.Print "FullPath: ", ref.FullPath
Debug.Print "Version: ", ref.Major & "." & ref.Minor
Else
Debug.Print "GUIDs of broken references:"
Debug.Print ref.GUID
EndIf

Next ref
End Sub

You can use the AddFromFile or AddFromGuid methods of the References
collection to add missing ones (Note: You can't do this in an MDE)

For references, check my
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html and
the various links I have there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top