Ok I have the following code
works great but when I press the cancel button it stops the action and doesnt undo (which is what I want) but now if I where to click close it doesnt ask anymore, I know that is due to it no longer thinking that the change that was made is no longer new so I thought if I changed
Case Is = vbCancel
'MsgBox "Cancel"
CancelYes = True
to
Case Is = vbCancel
'MsgBox "Cancel"
CancelYes = True
DoCmd.RunCommand acCmdUndo
DoCmd.RunCommand acCmdRedo
That would fix the problem as it would undo the change and then redo the change but the acCmdRedo doesnt work so how else can I tell access that the change that was made is still new and not an old change so that when the user closes for a 2nd time without making anymore changes they are prompted again
PHP:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Checkme <> True Then
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "Do you wish to save the changes?" & Chr(13)
strMsg = strMsg & "Click Yes to Save or No to Discard changes."
Select Case MsgBox(strMsg, vbQuestion + vbYesNoCancel, "Save Record?")
Case Is = vbYes
'MsgBox "Yes"
'do nothing
Case Is = vbNo
'MsgBox "No"
DoCmd.RunCommand acCmdUndo
CancelYes = False
Case Is = vbCancel
'MsgBox "Cancel"
CancelYes = True
End Select
End If
End Sub
Sub Form_Unload(Cancel As Integer)
On Error GoTo Form_Unload_Err
If CancelYes <> True Then
If ParentFormIsOpen() Then Forms![Employees1]!ToggleLink = False
If Me.TTotal_Score <> "" Then
Dim RaRound
Checkme = True
RaRound = DCount("[Initials]", "Inbound", "[Initials] = [Forms]![Inbound]![Initials]")
If [Forms]![Inbound]![RRound] <> "" Then
Else
If RaRound = "1" Then
[Forms]![Inbound]![RRound] = "1"
Else
[Forms]![Inbound]![RRound] = RaRound
End If
End If
End If
Else
'MsgBox ("This will stop it from closing")
DoCmd.CancelEvent
CancelYes = False
End If
Form_Unload_Exit:
Exit Sub
Form_Unload_Err:
MsgBox ("Not ME") 'Error$
Resume Form_Unload_Exit
End Sub
works great but when I press the cancel button it stops the action and doesnt undo (which is what I want) but now if I where to click close it doesnt ask anymore, I know that is due to it no longer thinking that the change that was made is no longer new so I thought if I changed
Case Is = vbCancel
'MsgBox "Cancel"
CancelYes = True
to
Case Is = vbCancel
'MsgBox "Cancel"
CancelYes = True
DoCmd.RunCommand acCmdUndo
DoCmd.RunCommand acCmdRedo
That would fix the problem as it would undo the change and then redo the change but the acCmdRedo doesnt work so how else can I tell access that the change that was made is still new and not an old change so that when the user closes for a 2nd time without making anymore changes they are prompted again