I have an exit button that closes my form. on the beforeupdate event have a msgbox asking the users if they want to save the changes. heres the code:
-----------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Confirm with user that this record is to be modified
Dim updRecord As Byte
updRecord = MsgBox("Are you sure you want to update this record", vbOKCancel, "Update Record Confirmation")
If updRecord = vbCancel Then
Dim CTRL As Control
For Each CTRL In Forms!changegroup
Me.Undo
Next CTRL
Cancel = True
End If
End Sub
-------------------------------------------------
when I click cancel i get an error : You cant save this record at this time
then it tells me the action close form failed.
I thought since I have the for loop changeing all of the data values back to what they were would avoid this problem. any ideas ???
thanks
-----------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Confirm with user that this record is to be modified
Dim updRecord As Byte
updRecord = MsgBox("Are you sure you want to update this record", vbOKCancel, "Update Record Confirmation")
If updRecord = vbCancel Then
Dim CTRL As Control
For Each CTRL In Forms!changegroup
Me.Undo
Next CTRL
Cancel = True
End If
End Sub
-------------------------------------------------
when I click cancel i get an error : You cant save this record at this time
then it tells me the action close form failed.
I thought since I have the for loop changeing all of the data values back to what they were would avoid this problem. any ideas ???
thanks