application.quit error

  • Thread starter Developer seeking for help
  • Start date
D

Developer seeking for help

The following codes produces the runtime error '91' object
variable or with block variable not set

Private Sub ExitButton_Click()
Application.Quit acQuitSaveNone
End Sub

Does anyone know why? Thanks
 
W

Wayne Morgan

Did you copy and paste your message or type it fresh? Check the spelling of Application in
your code. If that's not it, delete the procedure, delete the button, and recreate the
button and procedure. If that still doesn't do it, try a decompile.

To decompile,

1) Make a backup copy of your database

2) Open the database with a command line similar to
"<path>\msaccess.exe" "<path>\MyDatabase.mdb" /excl /decompile
Include any other switches you would normally use for user name, password, or
workgroup file.

3) When the database is open, do a Compact and Repair

4) When it reopens from #3, open a code window (Alt+F11) and choose Debug|Compile....
 
B

Bruce M. Thompson

The following codes produces the runtime error '91' object
variable or with block variable not set

Private Sub ExitButton_Click()
Application.Quit acQuitSaveNone
End Sub

Does anyone know why? Thanks

I would check for code in the form's "BeforeUpdate", "OnUnload" and "OnClose"
event procedures as a possible source of the error.
 
F

Fredg

Are you sure it's this code that is causing the error?
Do you run this from another procedure,
which perhaps is missing an End If or a Next.
Compile your code and see what comes up.

What happens if you use
DoCmd.Quit acQuitSaveNone
instead?
 

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