Code for cancel button problem
Here's my code. When the query is run that deletes the record out is when the problem occurs. That happens for a new order that is added. If the order is there and they just want to cancel the changes they made to it, then
it works as it should. Query is "DeleteUnusedOrder".
If Me!New Or Me.Dirty Or Me!Changed Then
Dim Response As Integer
Response = MsgBox("Are you sure you wish to cancel changes to " & Me!ID & "?", 292, "SOTS Cancel Order Editing")
If Response = 6 Then 'yes, cancel the change
'TODO: Undo all changes to steps and work orders
Form_WorkingClearanceMainFormPIC.Visible = True
DoCmd.SetWarnings False
If Me!New Then
DoCmd.OpenQuery "DeleteUnusedOrder", acViewNormal, acEdit
Else
Me.Undo
End If
DoCmd.Close acForm, "WorkingClearanceEditForm"
End If
Else
DoCmd.Close acForm, Me.Name, acSaveYes
End If