You can't save record at this time error

brian7268

Registered User.
Local time
Yesterday, 21:20
Joined
Mar 19, 2013
Messages
20
I have a form where I only want the user to be able to close the form and submit the form via buttons. I have disabled the menus, but I noticed a loop hole - some laptops will let the user close the form by pushing a quick button that I can't disable in access.

I have everything set up, but I just want to get rid of one annoying access window. After BeforeUpdate cancels the updating, a message comes up that says "You can't save the record at this time" and then asks the user if they still wish to close the database object. If the user selects yes, it eliminates the entries in the form, but won't close the form because the BeforeUnload event procedure won't let it close without the button.

Any help to resolve would be great. thanks!
 
What is the code in the BeforeUnload event that stops the form from closing.
 
Code:
Private Sub Form_Unload(Cancel As Integer)
        MsgBox ("Use the control buttons to upload or close the form.")
        Cancel = True
 End Sub
 
Perhaps you could declare a boolean type variable in the declaration section of the form's module with somthing like:
Code:
Option Compare Database
Option Explicit
Private blnAllowClose As Boolean
Set value of this variable to True in the section of code that closes the form with:
Code:
blnAllowClose = True
Then change the code in the form's UnLoad event to:
Code:
Private Sub Form_Unload(Cancel As Integer)
  If blnAllowClose = false Then
     MsgBox ("Use the control buttons to upload or close the form.")
     Cancel = True
  End If
 End Sub
 

Users who are viewing this thread

Back
Top Bottom