Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having Trouble With Discarding Changes On Form, Access 2016

Status
Not open for further replies.

StanJx

Programmer
Jun 2, 2016
29
0
0
LK
Hi,

I have a form called frmMaster. I am trying to apply a code when the form is closed mid entry or full entry, So that the user can discard the changes if necessary. I am having some trouble when the form is fully completed. It closes even though I give a vbNO option. Would appreciate some help to sort my code.

I got this code from the net and was trying to use it for my purpose.

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)my 
If bClose = False Then
   If MsgBox("Do you want to save the changes?", vbYesNo) = vbNo Then
            Cancel = True
   Exit Sub
   End If
End If
End Sub

In the Current Event bClose = false and my Save button bClose = true.

Any idea why my for is closing??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top