Test Library Reference

A

AEROTJK

Hello,

Is there a way to test whether a reference library is selected? For
example. I would like to see if the DAO reference library is already added
and if it is not, I would like to use the AddFromGUID.

Second, is there a way to ensure that there will be no hiccups between users
who have differing versions of any particular library.

Thanks in advance for your assistance!! :)
Aerotjk
 
T

Tony Toews [MVP]

AEROTJK said:
Is there a way to test whether a reference library is selected? For
example. I would like to see if the DAO reference library is already added
and if it is not, I would like to use the AddFromGUID.

Other than an "interesting" Windows Vista/Access 2007 problem which I
think Allen Browne documents at his website you shouldn't need to
worry about the DAO reference.

I've tested an A2000 MDE in A2003 and A2007 runtime environments
without any problems.

What kind of problems are you having with DAO references?

Here's some starter code to get you going.

Sub ViewReferenceDetails()

Dim ref As Reference

For Each ref In Access.References
Debug.Print ref.Name & " - " & ref.Major & "." & ref.Minor & "
- " & ref.FullPath
Next ref

End Sub
Second, is there a way to ensure that there will be no hiccups between users
who have differing versions of any particular library.

Late binding means you can safely remove the reference and only have
an error when the app executes lines of code in question. Rather than
erroring out while starting up the app and not allowing the users in
the app at all. Or when hitting a mid, left or trim function call.

This also is very useful when you don't know version of the external
application will reside on the target system. Or if your organization
is in the middle of moving from one version to another.

For more information including additional text and some detailed links
see the "Late Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
M

Marshall Barton

AEROTJK said:
Hello,

Is there a way to test whether a reference library is selected? For
example. I would like to see if the DAO reference library is already added
and if it is not, I would like to use the AddFromGUID.

Second, is there a way to ensure that there will be no hiccups between users
who have differing versions of any particular library.


Try looping through the Application.References collection to
see if the one you want is there or not.

Dim ref As Reference
Dim bolFound As Boolean
For Each ref in Application.References
If ref.Name = "something" Then
bolFound = True
Exit For
End If
Next ref
If Not bolFound Then
' it is not there
End If

I can't help with adding the reference.
 

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