Solved Prevent Saving Record while keeping data on form (1 Viewer)

Filledvoid

New member
Local time
Tomorrow, 03:57
Joined
Apr 14, 2016
Messages
3
Hello all,
I have a Microsoft Access 2010 database that uses a form that saves data related to a purchase (new records). Is there a way to prevent the accidental Tabbing out of the form and Saving the record . Ive been experimenting with the Before Update Section to either give me the ability to save changes, exit the form or cancel the update and stay in the form without losing data. But despite of what I enter the form seems to be losing the data I have typed in when choosing 'Cancel'

Would it be possible to change / add lines of code to this so that the above is accomplished.

Code:
Dim strMsg As String
Dim iResponse As Integer
    strMsg = "Do you wish to save the changes?" & Chr(10)
    strMsg = strMsg & "Click Yes to Save or No to Discard changes."
    iResponse = MsgBox(strMsg, vbQuestion + vbYesNoCancel, "Save Record?")
    If iResponse = vbNo Then
      
      
    ElseIf iResponse = vbCancel Then
    
    
    End If
 
Why state Yes or No, and offer Cancel?
 
Thanks all. Will definitely try this solution.

As for the three choices . I was trying to avoid the person having to enter in the data from the beginning if accidentally tabbing out or closing the form.
 

Users who are viewing this thread

Back
Top Bottom