I have the following code in the Unload event of a form:
If Me.NewRecord And IsNull(Me.PackSize) Then
MsgBox "Check Pack Sizing on " & Me.ProductDescription & "." & vbCrLf & "If unsure enter '0'.", vbCritical, "Missing Data Message from ZP"
Me.PackSize.SetFocus
Cancel = True
Exit Sub
Else
DoCmd.Close
End If
I want the user to be able to close the form if no new record has been added. I keep getting a 'Close action has been cancelled' error.
Can anyone see in my code why this would be happening?
Thanks in advance.
If Me.NewRecord And IsNull(Me.PackSize) Then
MsgBox "Check Pack Sizing on " & Me.ProductDescription & "." & vbCrLf & "If unsure enter '0'.", vbCritical, "Missing Data Message from ZP"
Me.PackSize.SetFocus
Cancel = True
Exit Sub
Else
DoCmd.Close
End If
I want the user to be able to close the form if no new record has been added. I keep getting a 'Close action has been cancelled' error.
Can anyone see in my code why this would be happening?
Thanks in advance.