Referencing libraries from a form

A

AndrewDB

I need to allow users to reference libraries, mainly to fix missing links,
without allowing them to access my code? OPTION 1: Is there a way to open the
library reference utility from a form, or OPTION 2: to create a form with
similar functionality? Ideally the correct option should be able to work with
an MDE.
 
A

AndrewDB

Michka provides lots of useful information, but not what I need. She does
mention that references can be set in a MDE through VBA, but not how to do
it. Is it possible to set the reference libraries at startup using VBA?
 
D

Douglas J. Steele

Did you bother to check the Help file? There are two different methods to
add entries to the References collection: the AddFromFile method, and the
AddFromGUID method. Using the AddFromFile method, you pass a full path to
the file. Using the AddFromGUID method, you pass the (you guessed it!) GUID
that identifies the type library.

BTW, Michka is a he: Michael Kaplan.
 
A

AndrewDB

Thanks Douglas (Oops sorry Michael)
I know that I've seen a code example that runs through the registered
libraries and checks that they are linked, if not it warns the user and opens
a dialogue box that allows the user to find and register it (or an
alternative). This was a couple of years ago and I can't remember where I saw
it.

The problem is that my app is used all over the country in all the different
Windows, Office combinations. I have gotten away with it so far by saving the
..mdb files in Access 2000 format. But I find this restrictive and second
best. By reading Michka's writings I've come to realize this is a more
general issue.

Anybody have more ideas?
 
D

Douglas J. Steele

No offense, but I'll repeat: have you checked the Help file?

The Reference object has an IsBroken property. You can loop through the
References collection and check that property:

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

Note that if the IsBroken property is True, Microsoft Access generates an
error when you try to read the Name or FullPath properties. That means that
it's prudent to store relevant information in a table so that you can
compare the table of expected references to what's returned from the
References collection.
 
A

AndrewDB

Thanks Douglas. I will try this and let you know. The problem with the help
file is that if you do not know the correct word to search for it leads you
down a maze of irrelevent information.
 
A

AndrewDB

Thanks Douglas - Works brilliantly. I have managed to re-create most of the
functionality of the Reference utility in the Tools menu of VBA and the best
is that it works with MDE as well. Thanks for the help
 
T

Tony Toews [MVP]

AndrewDB said:
I need to allow users to reference libraries, mainly to fix missing links,
without allowing them to access my code?

I'm curious. What kind of reference libraries are you having troubles
with?

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/
 
T

Tony Toews [MVP]

AndrewDB said:
Thanks Douglas. I will try this and let you know. The problem with the help
file is that if you do not know the correct word to search for it leads you
down a maze of irrelevent information.

I totally agree with you on that one. Frequently what we do in the
newsgroups is to figure out what you stated in your terminology and
then tell you in the products terminology what it is you wanted to do.

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/
 

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