Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Library Reference Priorities

Status
Not open for further replies.

andirus

Programmer
Sep 3, 2002
1
AU
Problem: I have created Front-Back Access97 app.
I have set the references as follows:
1. V Basic For Apps
2. MS Access 8.0 Obj Lib
3. MS DAO 2.5/3.5 Comp Lib
4. MS VBA App Extension
5. MS Word 8.0 Libary

I have created the FrontEnd as an MDE, then distributed by email so different people on the same network (NT4).

The FrontEnd switchboard has code in the ON_OPEN event that checks for and then re-links to the BackEnd.

Some people can use the database without any problem, while others get the Error 424, Can't create Object message.

This may have been coincidence, but when I checked the references on a PC that gave the error, I noticed that the library references, although there, were in a different order.
Once I have changed the priorities to the same as on my PC, the Database works fine !!??

Why is this, and can I include a routine to check for and change the priorities of libraries, upon opening the DB?

Ideas??
Andirus
 
The error appears because you're referring to some objects/properties from a library that exist (as names) in a higher level library, but different from what you need.

I guess you could change the priority by removing the references and reinsert them in the order you want. But I didn't test it, so it's not guaranteed...
Something like:

Dim myref As Reference
Dim myrefarray()
Dim i As Integer
'to store the references in an array
For Each myref In References
ReDim Preserve myrefarray(1, i)
Debug.Print myref.Name, myref.FullPath
myrefarray(0, i) = myref.Name
myrefarray(1, i) = myref.FullPath
i = i + 1
Next

On Error Resume Next
'to delete the references
For Each myref In References
References.Remove myref
Next

'to add the references from the array
For i = 0 To UBound(myarray, 1)
References.AddFromFile myarray(1, i)
Next i

You will need to sort or reorder the array before restoring the references. Or you may need to pre-populate the array with the references you need, in the order you need them.


HTH,

Dan
[pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top