setting default references

gblack

Registered User.
Local time
Today, 21:21
Joined
Sep 18, 2002
Messages
632
Is there any way to automatically set the references that you want to use, other than going into the VBA section and clicking them? Maybe set some more as default or something of that nature?

It is highly tedious to scroll through a huge list of choices, every time you create a new mdb file.

I thought there might be two ways of doing this, but as of yet I don’t know how you would.

First, if I use the same references in all my databases, shouldn’t there be a way to copy the used references from one database to the next…kind of like copying import specifications? If there is such an option, could someone please tell me where it is.

Secondly… go though some default setting mechanism that I don't know of?

Oh and another question: Is there any way to get rid of the choices in the reference drop down box so that I don’t have to scroll through a list of 200 references, in order to get the ones I need to use? I don’t have admin rights to my Dam…Darned machine, so I probably can’t move any dlls and such… so maybe that’s not a good question.

Anyway, I hope someone gets what I am asking and has some sort of solution I might be able to use.

Thanks,
Gary <-- who is tired of opening new MS Access applications and checking a bunch of those little boxes, before he can do anything…
 
gblack said:
Is there any way to automatically set the references that you want to use, other than going into the VBA section and clicking them? Maybe set some more as default or something of that nature?
Yes I have posted on this. You can load references by using VBA. There is no "default", but you can choose the name of the reference and its location.

It is highly tedious to scroll through a huge list of choices, every time you create a new mdb file.
Use the keyboard to get to the section of references that begin with a certain letter.


First, if I use the same references in all my databases, shouldn’t there be a way to copy the used references from one database to the next…
Look at using Code Libraries and MDEs

Oh and another question: Is there any way to get rid of the choices in the reference drop down box so that I don’t have to scroll through a list of 200 references
You don't want to do this as this is the list of reference libraries that Access recognizes. They are registered by your OS because another because Access or another application uses it. When you actually need one of these, you will have to add it to the list. To remove it from the list you will probably have to unregister it from your computer. As stated before there is a way to load references using vba. By using forms, working with your system's registry, or keeping your own tables of the references you commonly use, you can make your custom load reference list using VBA.
 
Ok

So you can code it:
Set ref = References.AddFromFile("C:\Program Files\Common Files\MicroSoft Shared\VBA\VBA332.DLL")

I guess my next question is: How the heck do I find the corresponding DLL for each of my references?

For instance I have a reference called:

Microsoft ActiveX Data Objects 2.5 Library

How do I match that up to a specific path?

When I go to: C:\Program Files\Common Files\Microsoft Shared

I can't seem to find it, and theres a bunhc of folders but none say Microsoft ActiveX or anything that simple... So do is there an easy way to correlate the name with the DLL path?
 
At the bottom of your references window, there is a location that says the full path of the reference. I think you can also get the path of the reference using the Reference Object (what you defined as "ref"). Just be aware if you're going to reference libraries in this way, the paths will be dependent on where the user has the reference stored, and what kind of operating system the user is using. Therefore, build a good error handler. I posted an example database somewhere on this site.

Note that you can also reference a library by using the "Declare" statement. Much like you may see when people use API function calls.
 
does the attached help?

one form finds the references & file names on your dev system.
the other form sets the references you want on the client system.

don't use full paths for the libraries - they may not be where you think they are on the client machine. let the search thing take the strain.

first use of the MDE/MDB using utilityLibLoad takes time while search trawls for any missing libraries. next time its milliseconds.
yes it DOES work on MDE as well! <<<<<< Oh no it doesn't!
yes it would be nice if someone wrote an extension to look beyond C: (send me a copy please).
yes you could add a table that stored the "normal" locations for the libraries so that most times first-startup would be faster (send me a copy please).

set utilityLibLoad as the startup form. there's a constant up at the top to define the "real" startup form of your application.

izy

NO it doesn't work in MDE
guess i should have mentioned this a thousand years ago - you can't change references in MDE
...since the original post, i've moved to late-binding for all "bizarre" references.
 

Attachments

Last edited:
Thanks!

You guys are awesome!!! I'm going to be working on this today... I'll tell you how it all works out when I am finished!

Thanks again for all the info!!!

Gary
 
Ahh

Izy,

I'm getting an error when I try to run the form(utilityLibLoad). I have set the path in the table to find snapshot... but when I run it I get a message saying that it can't find the frmMain... In your code you set frmOpen = "frmMain", but there is no frmMain in the database... Am I doing something wrong?

Gary



Private Sub LibLoad0()


'' ''
'' BEGIN PROGRAMMER-SET PROPERTIES BLOCK 1 of 2 ''
'' ''
'' Declare the number of references to be checked/set as Const maxRefs ''
'' Declare which form to open on successful conclusion as Const frmOpen ''
'' ''
Const maxRefs = 2
Const frmOpen = "frmMain"
'' ''
'' END PROGRAMMER-SET PROPERTIES BLOCK 1 of 2 ''
'' ''
 
Last edited:
OK Next problem

When you try to set a reference that conflicts with another, the set doesn't take. This workd the same way in the GUI. When you check on a reference and there's already another version checked, access will tell you that there is a conflict with another version.

I was wondering if anyone knew how you could bypass that issue and code to force your references to go through?

Thoughts???
 
You must unload the references using the Application.References object.
 
Gary - getting back to the missing frmMain.

...there's a constant up at the top to define the "real" startup form of your application.

' Declare which form to open on successful conclusion as Const frmOpen
Const frmOpen = "frmMain"

...that need to be the name of the form you want the user to see when your application starts up. e.g. your switchboard, your main form, your copyright screen - whatever you were using before as your "startup" form: just stick that name into the constant frmOpen. i use libload for all my applications - the slightly ugly constants make setting up for each application simpler.

utilitylibload is invisible unless some sort of catastrophic error occurs.
from second-use onwards it unloads in a few milliseconds to show whatever form you defined with the constant frmOpen.

izy
 
I tried the LibraryLoader and it gave an error message "could not find VB:vbe6ext.exe" and exited Access. Now, because I altered the startup to be the libraryloader it just does the same thing whenever I load the mdb. I want to remove the loader from the startup but cannot do so. Help!
 
try holding the shift key in when opening the DB. that should stop any code running

HTH

Peter
 
Thanks Bat17 I did that and sorted most things out. Locked in battle with other gremlins now
 

Users who are viewing this thread

Back
Top Bottom