Refreshing the Reference List

  • Thread starter Thread starter larry
  • Start date Start date
L

larry

I am moving an application written in Access 2002, on a machine with Office
97, to a machine that contains the complete Office XP suite. I have a
reference link problem that appears to be resolvable by refreshing the
reference list (Knowledge Base Article 310803): Select a new reference,
close the window, reopen the reference window and deselect the new
reference.

Is there a way to do this from a VBA program? I don't really want to explain
this procedure to end users that should not even know that VBA code exists.

Thanks.

Larry
 
Yes, there are ways to fix references through code. You can have code that
loops through my references to ensure that they're all okay. If they're not,
you need to Remove the broken reference, then use either AddFromFile or
AddFromGUID to add it back. The problem is that broken references can't give
you much information, so what I often do is include a table in my front-end
that contains the full path and GUID for each of the references I'm using.

Michka's got some good stuff at
http://www.trigeminal.com/usenet/usenet026.asp or for a more general
overview of references, check what I have at
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html


However, what you really should do is ensure that you have the same version
of the reference on all machines, so that you don't have to do any of this.
 
Douglas J. Steele said:
Yes, there are ways to fix references through code. You can have code that
loops through my references to ensure that they're all okay. If they're not,
you need to Remove the broken reference, then use either AddFromFile or
AddFromGUID to add it back. The problem is that broken references can't give
you much information, so what I often do is include a table in my front-end
that contains the full path and GUID for each of the references I'm using.

Michka's got some good stuff at
http://www.trigeminal.com/usenet/usenet026.asp or for a more general
overview of references, check what I have at
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html


However, what you really should do is ensure that you have the same version
of the reference on all machines, so that you don't have to do any of this.

Thanks. I just browsed those articles so far but I think they should help.

There is a limit to the development environment. As I said, I wrote it using
Access XP but the rest of Office is 97, but my user is using the complete
Office XP suite. This application uses Outlook -- 97 or XP as may be -- to
send some mail, and that reference is the only one that should be different.
I didn't see any MISSING reference messages which made debugging it a bit
more interesting. I ended up using an unregistered copy of Office XP on an
old machine to debug it. I have about 40 loads left to get it to work.

Larry
 
larry said:
There is a limit to the development environment. As I said, I wrote it using
Access XP but the rest of Office is 97, but my user is using the complete
Office XP suite. This application uses Outlook -- 97 or XP as may be -- to
send some mail, and that reference is the only one that should be different.

In which case you might want to use Late Binding. Especially if on
some systems Outlook might not exist. But it may also be that Access
is having trouble switching from whatever version of Outlook is on
your system to a different version on some of the client systems. But
that's just a guess.

Late binding means you can safely remove the reference and only have
an error when the app executes lines of code in question. Rather than
erroring out while starting up the app and not allowing the users in
the app at all. Or when hitting a mid, left or trim function call.

You'll want to install the reference if you are programming or
debugging and want to use the object intellisense while in the VBA
editor. Then,. once your app is running smoothly, remove the
reference and setup the late binding statements.

Sample code:
' Declare an object variable to hold the object
' reference. Dim as Object causes late binding.
Dim objWordDoc As Object
Set objWordDoc = CreateObject(" Word.Document")

For more information including additional text and some detailed links
see the "Late Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
Tony Toews said:
different.

In which case you might want to use Late Binding. Especially if on
some systems Outlook might not exist. But it may also be that Access
is having trouble switching from whatever version of Outlook is on
your system to a different version on some of the client systems. But
that's just a guess.

Late binding means you can safely remove the reference and only have
an error when the app executes lines of code in question. Rather than
erroring out while starting up the app and not allowing the users in
the app at all. Or when hitting a mid, left or trim function call.

You'll want to install the reference if you are programming or
debugging and want to use the object intellisense while in the VBA
editor. Then,. once your app is running smoothly, remove the
reference and setup the late binding statements.

Sample code:
' Declare an object variable to hold the object
' reference. Dim as Object causes late binding.
Dim objWordDoc As Object
Set objWordDoc = CreateObject(" Word.Document")

For more information including additional text and some detailed links
see the "Late Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm

Thanks. That can help. I want to send a text file and would like to use
Outlook if it is there but try OutlookExpress otherwise (I can't attach the
file in OE but I can start it up and prompt the user). At the moment I'm
using compile directives but that's messy.

The fun thing is I didn't get any compile errors and had no problem with
the form that actually uses the Outlook stuff (because I didn't get that
far). The error was something like "invalid expression in record
validation." Of course it doesn't say exactly where. It also doesn't set any
default values. Some are Date() but some are simple integers.

"Or when hitting a mid, left or trim function call." That's one of the
things I can't figure out. The library in question has nothing to do with
these simple functions but somehow affects them.

Larry
 
larry said:
The fun thing is I didn't get any compile errors and had no problem with
the form that actually uses the Outlook stuff (because I didn't get that
far). The error was something like "invalid expression in record
validation." Of course it doesn't say exactly where. It also doesn't set any
default values. Some are Date() but some are simple integers.

"Or when hitting a mid, left or trim function call." That's one of the
things I can't figure out. The library in question has nothing to do with
these simple functions but somehow affects them.

One bad apple and all that.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
Back
Top