• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Access 2007 - how to cancel the closing of the database?

Hi Experts,

I'm trying to check for a condition when a form is deactivated. If the condition is true, I really want the user to get the message before they're done with their session. The "On deactivate" event for the form fires when the user attempts to close the database. Can I use the "On deactivate" code to stop the user from closing the database if the condition is true? How would I stop the database from closing?

Thanks!!!
0
JC_Lives
Asked:
JC_Lives
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Use the Form Unload event, which can be cancelled:

Private Sub Form_Unload(Cancel As Integer)
    If <YourCondition> = True Then Cancel = True
End Sub

mx
0
 
JC_LivesAuthor Commented:
Perfect, thank you.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
You are welcome ...

mx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now