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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing References across network

Status
Not open for further replies.

EriRobert

MIS
May 9, 2003
114
GB
Hello

If anyone has any ideas on this one I would appreciate it:

This company runs a Access 97 database on a network. The network is a mixture of Windows NT and Windows 2000 workstations and the application and data databases are held on the server.

When the application (developed on the W2000 workstations) is moved to the server when it is accessed from the NT machines missing reference messages are given and Tools --> References has to be used to uncheck the missing ones and select the equivalent ones. Then the application is OK while it is accessed from the NT machines.

When the application is run from the W2000 machines the same thing happens.

I know that if the application resided on each client this problem would not occur but that is not a solution they like.

Any ideas

ERIROBERT

 
I don't know if there is a way to progammatically change references. The standard way a professional programmer would handle this problem is to write an install program for his app which would install the correct dll's, ocx's etc the app requires, doing the correct registry updates for those objects in the process.
 
You can programmatically change references, but you need to know the paths and filenames of the different versions of the libraries. I guess you could keep these stored in one central location on the network.

To change references you need to use the References property of the Application object.]

Check the help files but you would need to check which operating sys is running and then if appropriate remove the relevant problem references and add the new ones using the path. Something like:
Code:
References.Remove "
Code:
ReferenceName
Code:
"
References.AddFromFile "
Code:
FilePath
Code:
"

If you need more help I could elaborate.

Dean :)
 
I would definately look at putting the application file on the local machine. Things will be so much more secure & stable.
If this is really not possible (and I mean REALLY REALLY not possible) then you may get away with getting rid of all the references and use late binding.
This means that if you are using the Word references, instead of having:
Dim wd as New Word.Application
and a reference set to word 8.0 (or whatever)
you would have
Dim wd as Object
Set wd=createobject("Word.Application)

this will slightly slow your code, but nothing too bad.


Without knowing which references you have set, it's difficult to advise on workrounds.

hth

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
 
oharab,that might work in his situation, but

Set obj=createobject(Someobject) in some cases can also
look for things that might not be there.

Writing an install program beats trying to outguess the client environment. When they upgrade to XP he'll just go nuts with it all over again. On a corporate network, he should just write all the correct dll's to a shared folder and write a script or even a batch file to call regsvr on the client. Its not that hard. Then no matter what op system he hits it will work.


 
Total agreement with you vbajock, it was just a suggestion for working round particularly obstructive colleagues.
Creating a proper install with the front end on the local machine is by far the best way to go & I would advise Eri to push for that if possible, but he may have to try & work round them.

Cheers

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
 
Thanks everyone.

I'm going to spend some time today looking at manipulating the references collection as DeanW suggests.

My initial thoughts though:

I will need to know whether the local machine is running WNT or W2K - is there a API to detect this?

Will I have a problem of needing the correct references present before coding the .removes and .addfromfiles?

Anyway thanks again


Robert
 
To detect your OS version:
I'm not sure about what will happen to the invalid references at startup, but you may get errors.

Best thing to do is set up a Micky Mouse system and test it!

Good luck

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
 
Hello again

Just an end of day progress report really.

I thought I was making good progress. I got the remove and addfromfile methods working, but when I renamed a OLB file to generate it going missing the Tools --> References correctly stated Missing but in code the IsBroken property crashed with 'Error in Loading DDL' which I don't understand yet. Anyhow I also found this in the help:

If the IsBroken property is True, Microsoft Access generates an error when you try to read the Name or FullPath properties.

This will cause me a problem (even if I can get over the 'Error loading DDL') as I won't be able to access the name of the Missing Reference that needs to be refreshed. The information must be there somewhere as Tools-->References shows this information against Missing ones.

Any pointers appreciated

Robert
 
The following code will loop through any selected reference.

Function ReferenceInfo()

Dim strMessage As String
Dim strTitle As String
Dim refItem As Reference

On Error Resume Next

For Each refItem In References
If refItem.IsBroken Then
strMessage = "Missing Reference:" & vbCrLf & refItem.FullPath
Else
strMessage = "Reference: " & refItem.Name & vbCrLf _
& "Location: " & refItem.FullPath & vbCrLf
End If
Debug.Print strMessage
Next refItem
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top