T
TrueNorth
Guest
This turns out to be incredibly easy.
First you need a form that is always open, but not necessarily visible - let's call it frmMain. Then you need a way to know whether or not you want the user to be able to close Access. You could use a Public or Global variable that you can set and test from any form. I used a field in a linked table so that I can change it while the application is running. That way I can allow or prevent users from closing the application.
In the Unload event for frmMain, decide whether or not you want the user be able to close the application. If not, add the line:
Cancel = True
So it would look something like this:
If OK_to_Close = "No" Then
Cancel = True
End If
First you need a form that is always open, but not necessarily visible - let's call it frmMain. Then you need a way to know whether or not you want the user to be able to close Access. You could use a Public or Global variable that you can set and test from any form. I used a field in a linked table so that I can change it while the application is running. That way I can allow or prevent users from closing the application.
In the Unload event for frmMain, decide whether or not you want the user be able to close the application. If not, add the line:
Cancel = True
So it would look something like this:
If OK_to_Close = "No" Then
Cancel = True
End If