Missing References on Shared dbs (1 Viewer)

Roni Sutton

Registered User.
Local time
Today, 10:05
Joined
Oct 18, 1999
Messages
68
We are having an irritating problem. Occasionally, references in Access 2k dbs go missing. We have no idea what is causing it, but it's incredibly annoying. In particular, we seem to lose the dao and ado references OR they get switched in the list and then we get weird errors in our VBA code. Anybody got any ideas?
 

WayneRyan

AWF VIP
Local time
Today, 10:05
Joined
Nov 19, 2002
Messages
7,122
Roni,

I don't know why it happens, but missing references are a
common problem with Access. Just do a search in this forum.

This is a routine that we uses to programmatically set ours:

' ****************************************
Private Sub SetRefs_Click()
Dim ref As Reference
Dim intRef As Integer
Dim ErrorMsg As String

On Error GoTo ErrHandler

intRef = 1
Set ref = References.AddFromFile("C:\Program Files\Common Files\MicroSoft Shared\VBA\VBA332.DLL")

intRef = 2
Set ref = References.AddFromFile("C:\Program Files\MicroSoft Office\Office\MSACC8.OLB")

intRef = 3
Set ref = References.AddFromFile("C:\Program Files\MicroSoft Office\Office\MSO97.OLB")

intRef = 4
Set ref = References.AddFromFile("C:\Program Files\Common Files\MicroSoft Shared\DAO\DAO360.DLL")

intRef = 5
Set ref = References.AddFromFile("C:\Program Files\MicroSoft Office\Office\MSPRJ9.OLB")

intRef = 6
Set ref = References.AddFromFile("C:\Program Files\MicroSoft Office\Office\EXCEL8.OLB")

Exit Sub

ErrHandler:
Select Case intRef
Case 1
ErrorMsg = "No VBA332"
Case 2
ErrorMsg = "No DAO360"
Case 3
ErrorMsg = "No MSACC8"
Case 4
ErrorMsg = "No MS097"
Case 5
ErrorMsg = "No MSPRJ9"
Case 6
ErrorMsg = "No EXCEL8"
End Select

MsgBox (ErrorMsg)

End Sub
' ****************************************

hth,
Wayne
 

PaulA

Registered User.
Local time
Today, 10:05
Joined
Jul 17, 2001
Messages
416
Where would you place this function?

This situation may be similar to something I am experiencing (see message above) where one user gets an error message probably due to a reference.

Where would you place this function? In a start up procedure?

Thanks.

Paul A
 

WayneRyan

AWF VIP
Local time
Today, 10:05
Joined
Nov 19, 2002
Messages
7,122
Paul,

I have it behind a command button on a Maintenance screen
that the users can't see. This is only used once a month or
so. It could live in a public module. I don't know that I'd
invoke it on Startup unless references are a big problem.

If your references are getting hammered frequently, I would
try to attack that. The code is just a quick, easy way to fix it.

We have Excel and MSProject VBA code in our database. Users
had different versions of these apps and the references would
keep flip-flopping between them. We finally just standardized
all the user software will all 2000 products and the problem
is gone.

Wayne
 

sambo

Registered User.
Local time
Today, 02:05
Joined
Aug 29, 2002
Messages
289
Wayne,

Could you please expand a little more as to the symptoms of these missing References Problems..

What type of errors do they produce (numbers)?
Is it imperative that all users have the same Access Version as was used to develop the database?
Is it imperative that all users have the same Access Version as all other users?
Does the Reference problem typically corrupt the Database to where it has to be Repaired?
Is the Reference Order (set in Code Window) Imperative?

Thanks for your response..
 

servoss

Registered User.
Local time
Today, 10:05
Joined
Dec 31, 2002
Messages
46
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?!?!?!
 

WayneRyan

AWF VIP
Local time
Today, 10:05
Joined
Nov 19, 2002
Messages
7,122
servoss,

Does you code look like this?

Code:
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

You don't want the lines split like this:

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

What was the Error Number and description?

Wayne
 

Users who are viewing this thread

Top Bottom