Exiting Access Problem

D

Don Stone

Greetings--

I am experiencing a problem with exiting Access in the following code
snippet:

If Len(MainDBDir) = 0 Then
DoCmd.RunCommand acCmdExit
Else
MainDBDir = MainDBDir & ":\Student Tracker"
End If

It seems that even when MainDBDir is zero length, the exit is ignored. I
have other instances of using the same exit command and it never fails.

Is there anything that could be causing this exit command to fail?

I am running a 2003 database using Access 2007. If I run the database using
Access 2003, it exits without failure. Somehow using 2007 for a 2003
database can cause problems.

Any help would be greatly appreciated.
 
D

Don Stone

Thanks for the help!
It did solve the problem. However, any idea as to why the other did not
work?

Don
 
K

Ken Snell MVP

RunCommand actions can be flaky and unpredictable because you cannot ensure
that they will act on the object that you wish. DoCmd.Quit explicitly tells
ACCESS to quit ACCESS...period.
 

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