so it didn't work...
I was directed to this thread as I asked a similar question.
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.
WHAT AM I DOING WRONG?!?!?!