How do you change (or confirm) references in code? (1 Viewer)

shacket

Registered User.
Local time
Today, 02:28
Joined
Dec 19, 2000
Messages
218
I ask this questions for two reasons:

1. Our network consists of PCs running WinXP and PCs running Win98. The references for one don't work on the other (some come up as "MISSING").

2. If I were to sell a database to someone across the country who has Access, but doesn't know the behind-the-scenes, I want to know that their references will be correctly marked (enabled).

Is there a way to, in VBA, write a code that looks like this:

If (this.reference exists) Then
Enable (this.reference)
Else
Disable (this.reference)
Enable (that.reference)
End If

If so, what would it look like? Would you have to find the source file on the C drive? Also, the file I have trouble with is called "Microsoft VBScript Regular Expressions 1.0". It's source is "..vbscript.dll/2", while others are "..vbscript.dll/1" or "..vbscript.dll/3". How would you differentiate those? If I remember correctly, the files look the same in the folder they are called from.

Thanks!
 

John.Woody

Registered User.
Local time
Today, 02:28
Joined
Sep 10, 2001
Messages
354
I'm working on this at the moment. It's not perfect but it should give you a start.

Private Const mda As String = "SIS001.mda" ' Reference Name

Public Function Load_Refs()
Dim SIS1 As References
Dim refPath As String

On Error Resume Next

refPath = CurrentDBDir ' Path to currentdb which fails if reference not available
refPath = FixPath(refPath) & mda

Set SIS1 = References.AddFromFile(refPath)
If Err = 32813 Then
Exit Function
End If

End Function

To search for a file search help for Aplication.Filesearch, that should get you going on that one.

HTH
John
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:28
Joined
Feb 19, 2002
Messages
43,534
This is a pretty good article on the topic:

ACC2000 How to Resolve Reference Issues in an Access Database (Q310803)
 

Users who are viewing this thread

Top Bottom