references trouble (maybe...?)

G

Guest

Sorry for re-posting this, but I really need help.
There's something going on that I cannot immagine how to manage anymore.
I have developed an application on Access2003. It is a database code behind
the scene. But it's not that complicated. All forms are unbound and a mix of
SQL and ADO is used to pull data into tables. Sometimes a few DAO is used for
some other purpouse.
On my pc everything works fine. Debug doesn't show any error. It happens
that on user pc some features end up with Runtime errors (sometimes 91,
sometimes 2113). User's pc has Office 2003 installed. The user said ti has
checked for MiSSING reference but it seems nothing was wrong.
I have referenced ADO 2.1 thinking to backward compatibility. Should I
refence to ADO 2.5 instead?
Any hint?

Thanks,
Rocco
 
G

Guest

Hi

I have a similar problem where my distributed application has 'dropped' a
reference to the ADO file, even though the file is there. The application has
been distributed to some 30 users but the problem only manifests itself on a
handful of PC's - I cannot see any commonality of systems to explain.

My workaround is to deliberately delete the reference link, then
re-establish. The code is:

On Error Resume Next

Dim ref As Reference
Set ref = References!ADO
References.Remove ref
References.AddFromFile "c:\program files\common
files\system\ado\msado25.dll"

On Error GoTo Err_Handler

The code runs from the initial 'Welcome' screen and only needs to run once
as the reference link, once established is maintained. The eror code ensures
the application doesn't bomb-out if the link is already working.

Good luck.
 
G

Guest

Thanks for your reply,
actually my situation is a little more complex than your.
Keep in mind that the application runs on computers that have installed some
the english version of Office2003 and some the Italian one. So referencing
trough code can be challenging since the path is not always the same.
I cannot ask users to fix it themselves by going in VBE and tools>references
since I'm delivering MDE and References will be greyed out.
I can try to run code using some Office features, kind of Search Dialog to
retrieve by code the path for each of the libraries referenced in the
project. I hope it will work.
Sounds kind of odd that none has answered other than you, I was thinking
that troubles with references were much more common. Anyway, Thank you again
for your help.
Rocco
 
G

Guest

Hi Rocco

Actually, my situation is very similar to yours. The code I gave you was the
simplified version. I also distribute to users who have, potentially, every
combination of O/S, language etc.

What I did was to copy the ADO .dll file to the application's folder and
reference it from there (delete the existing reference then click on Browse
to find the new copy). Its important that your development application is in
the same folder that your installation wizard will install to (if you're
using the MS packaging wizrd, this happens by default).
Then, when running the installation wizard I include the .dll file, to be
installed in the Application folder. My delete/re-reference is then easy as I
can overcome the different path issue by using the
application.currentproject.path method. So my code actually reads:

....
References.AddFromFile Application.CurrentProject.Path & "\msado25.dll"
....

The only problem will be if users choose to install to a different location.
In this case you could probably use relative referencing but I've not tried
this - best to tell them to accept the defaults.

Hope this helps.
 
G

Guest

Sorry rocco, the 'name' of the ADO .dll is ADODB and not ADO as I mentioned
below. Note that the file itself is msado25.dll. You need to use both, as
below, for this to work.
 
G

Guest

Thank you so much!!
Rocco

BeWyched said:
Sorry rocco, the 'name' of the ADO .dll is ADODB and not ADO as I mentioned
below. Note that the file itself is msado25.dll. You need to use both, as
below, for this to work.
 
G

Guest

Your welcome!

One final thing - you will have to register the ADO file in its new location
so, the first line of coding should be:

Dim obj
obj = Shell("regsvr32.exe """ & Application.CurrentProject.Path &
"\msado25.dll""")

Stay cool!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top