D
DebbieG
I'm trying to disable the Access "X" button in my application. It's working
but I've got a logic problem. Maybe another set of eyes will see it. This
code is behind my frmMain which I use as a switchboard. I'm only showing
the code where I'm having the problem.
Private AllowExit As Boolean 'can only exit on frmMain
Private Sub Form_Open(Cancel As Integer)
AllowExit = False
End Sub
Private Sub cmdExit_Click()
AllowExit = True
Application.Quit
End Sub
Private Sub Form_Unload(Cancel As Integer)
If AllowExit = False Then
msg1 = "To close this application, first close all forms and"
msg2 = "then click the 'Exit Program' button on the Main form."
style = vbExclamation
Response = MsgBox(msg1 & vbCrLf & msg2, style, conTitle)
Cancel = True
End If
End Sub
If I click the Access "X" button, I get the message from Form_Unload.
Great! If I click the cmdExit button, the application closes but I still
get the message from Form_Unload. What am I missing?
Thanks,
Debbie
but I've got a logic problem. Maybe another set of eyes will see it. This
code is behind my frmMain which I use as a switchboard. I'm only showing
the code where I'm having the problem.
Private AllowExit As Boolean 'can only exit on frmMain
Private Sub Form_Open(Cancel As Integer)
AllowExit = False
End Sub
Private Sub cmdExit_Click()
AllowExit = True
Application.Quit
End Sub
Private Sub Form_Unload(Cancel As Integer)
If AllowExit = False Then
msg1 = "To close this application, first close all forms and"
msg2 = "then click the 'Exit Program' button on the Main form."
style = vbExclamation
Response = MsgBox(msg1 & vbCrLf & msg2, style, conTitle)
Cancel = True
End If
End Sub
If I click the Access "X" button, I get the message from Form_Unload.
Great! If I click the cmdExit button, the application closes but I still
get the message from Form_Unload. What am I missing?
Thanks,
Debbie