Reference and 3075 error

B

Brian

I just added the Map Point Object Library to an application of mine. I cannot
guarantee that any particular PC will have MapPoint installed, so I would
obviously expect calls that use it to fail on workstations not having
MapPoint installed. So, I just trap "unable to create object" type errors on
those stations.

However, I am now experiencing anomalies with other parts of the program -
only on computers not having MapPoint installed.

For example, in a particular query (having nothing to do with Map Point), I
get this error:

3075: Function is not available in expressions in query expression

When I remove the Map Point object library reference, this problem disappears.

What am I doing wrong?
 
D

Douglas J. Steele

Now that you've got things working, consider switching to Late Binding so
that you don't need the reference.

Tony Toews has information about this at
http://www.granite.ab.ca/access/latebinding.htm

In a nutshell, you need to:

1. Change how you declare your variables from
Dim appMappoint As MapPoint.Application
to
Dim appMappoint As Object

2. Change how you instantiate your variables from
Set appMappoint = New MapPoint.Application
to
Set appMappoint = CreateObject("MapPoint.Application")

3. Replace any references to intrinsic MapPoint variables with their actual
value, or else declare the constants in Access

Point 3 is the hardest, as it's really easy to overlook their usage. It's
absolutely essential that you require declaration of all variables (the
first line of each module must have Option Explicit). Once you remove the
reference, compile the application (It's under the Debug menu while you're
in the VB Editor). That should identify all of the constants you have to
fix.
 
B

Brian

Thank you, Douglas.

I will try that. I have seen posts before on late binding but have just
never sat down and worked with it. I do see in the Map Point VB/VBA
documentation descriptions of exactly what you say. It also indicates that
there are some specific advantages & disadvantages to each method, so I will
have to make sure that there is not some material downside to it.

It will not be difficult to find where it is used. Rick Fisher's Find and
Replace is one of my most valuable (and most often used) tools when going
back & reconfigure code like this.
 

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