KeithWilliams
Registered User.
- Local time
- Today, 02:04
- Joined
- Feb 9, 2004
- Messages
- 137
Hi,
I have scoured the forum but not found a satisfactory answer to my query. I hope someone can advise.
I have a form I want to open first when the database is opened, and not allow to close until the user closes the database.
I can disable the close button using Close Button property = No for the form. But the user can still close it using ALT-F4.
To prevent this I coded:
But this also prevents the user from closing the database, which I don't want.
I need to enhance the above code to allow the form to close if the user is closing the database, but not if they are closing just the form. Something like:
Can anyone suggest how to do this? I don't want to disable the File>Exit or application close buttons as this would confuse (or even enrage?) my technophobe users.
Many thanks,
Keith.
I have scoured the forum but not found a satisfactory answer to my query. I hope someone can advise.
I have a form I want to open first when the database is opened, and not allow to close until the user closes the database.
I can disable the close button using Close Button property = No for the form. But the user can still close it using ALT-F4.
To prevent this I coded:
Code:
Private Sub Form_Unload(Cancel As Integer)
Cancel = True
End Sub
But this also prevents the user from closing the database, which I don't want.
I need to enhance the above code to allow the form to close if the user is closing the database, but not if they are closing just the form. Something like:
Code:
Private Sub Form_Unload(Cancel As Integer)
If Not <application is closing> Then
Cancel = True
End If
End Sub
Can anyone suggest how to do this? I don't want to disable the File>Exit or application close buttons as this would confuse (or even enrage?) my technophobe users.
Many thanks,
Keith.