Mappoint from Access

R

Randy

When I instantiate Mappoint from my Access application it works great.
But if my users close the Mappoint application after viewing their map,
it leaves the Mappoint process running. SO if they route 4 or 5 times,
and close it every time, they end up with 4 or 5 Mappoint.exe processes
running. This eventually cause one of several things to happen:

1) Mappoint stops working
2) Access starts hanging
3) The system hangs and requires a reboot

Also, when I plot Lat / Lon from multiple addresses - the function I
use open mappoint and closes it again, if I do it 4 times, it leaves 1
or 2 processes running.

Is there someway that I can ensure that the process gets killed from
within my VBA code? I have tried objapp.quit, but it seems to be shaky
and doesn't always work. If the Mappoint is closed, but the process is
still running it errors out and doesn't kill the process.

You help is appreciated

Randy
Software Engineer
 
A

Alex Ivanov

I'm not familiar with Mappoint, but I believe the problem is because of how
you instanciate/terminate it. Here is a few points to check:
You may still have object variables pointing to Mappoint after user closed
the app. If you never use these variables, try to immediately set them to
Nothing after you made the Mappoint visible. If you do use them in Access,
try to declare them WithEvents and handle the Close or Quit or whatever they
call it events and set the var=Nothing inside that event.
You may also try to use GetObject instead of CreateObject or the New
operator.
GetObject will try to get the running instance of the app, if possible. That
does not always work, but in many cases it does.

HTH,
Alex.
 
J

Joshua A. Booker

Randy,

After using objapp.quit make sure to set your variables to nothing like
this:

set objapp = Nothing

Also, try to use the same instance of Mappoint for subsequent calls from
Access. To do this, you can make objApp a public variable and check to see
if it's set before opening a new mappoint instance. If it is set then use
it, otherwise open mappoint. This should insure each instance of Access
only uses a single instance of Mappoint.

HTH,
Josh
 

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