Ensuring references in distributed databases (and VBA)?

servoss

Registered User.
Local time
Today, 06:10
Joined
Dec 31, 2002
Messages
46
Hello.

I performed a quick search and didn't find anything to help, so if there is a previous posting that addresses this, I apologize for not finding it.

My issue is I have built an Access database with numerous VBA code calls and objects. I also reference several libraries, as you might've guessed. Not least of which is the Microsoft ActiveX Data Objects Recodset 2.7 Library - MSADOR15.DLL. However, when I install the databse on another machine, this library is unfound and error ocurs upon first call to a function in this library.

So, I can copy the library file to the new machine and then link the reference to the copied library file to make everything work, but I certainly don't want to have to walk people through having to do that on every machine to which I distribute the database.

I've checked a couple articles, including "Access Reference Problems" (http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html) and several of the articles referred to within, but cannot find anything concrete. The closest solution is that one of them says that the library file search path includes the folder in which the application resides, which in this case is Access. Unfortunately, it seems as though this could be, and likely is, operating system dependent, otherwise I'd simply copy the library to where I suspect msaccess.exe resides.

Do any of you have another reasonable solution? Or, am I simply missing something obvious (this has certainly happened before!)?

Any assistance you can provide would be most helpful.

Your humble student,
Tom
 
Thanks, but...

Thanks for the suggestion. The site has quite a lot to offer. Unfortunately, I do not see a "download" section, so could you be a little more specific as to where to find a potential answer to my question?

Thanks, again,
Tom
 
I tried these and it didn't work!

After reading the series of notes i thought the answer to my issue was provided. Alas, when coded, it did not work. Specifically, it did not appear to load the references at all - at least the ErrorHandler was invoked every time. I obviously changed the path to each library file in the code to match mine, of course, but can think of nothing else right off that might be tried to correct the situation.

Here is the sub that I coded up:

Sub SetRefs()

Dim ref As Reference
Dim intref As Integer
Dim ErrorMsg As String

On Error GoTo Err_SetRefs

intref = 1
Set ref = References.AddFromFile("C:\Program Files\Taugas\Inspection Butler\Lib\MSADOR15.DLL")

intref = 2
Set ref = References.AddFromFile("C:\Program Files\Taugas\Inspection Butler\Lib\MSADO25.TLB")

Exit Sub

Err_SetRefs:

Debug.Print DBEngine.Errors(0).Number
Select Case intref
Case 1
ErrorMsg = "No MSADOR15.DLL"
Case 2
ErrorMsg = "No MSADO25.TLB"
End Select

MsgBox (ErrorMsg)

End Sub

I just had a thought. Does it matter that I am only trying to add a couple of the references rather than the whole list?

Or, suppose I try to do this for a database more than once? Will this adversely affect things?

In a nutshell, I want to be able to distribute this database to several people, each with a unique environment, perhaps, and have ot work correctly for everyone. I thought i would distribute the correct reference files with the database and then link to them in the code. This does not seem to be working correctly.

By the way, i read through the second link in the previous note several days ago and was unaided by it.

WHAT AM I DOING WRONG?!?!?!
 

Users who are viewing this thread

Back
Top Bottom