I wanted on close button
Code:
If Me.frmSubBookingsControl.Form!StatusID = 5 And IsNull(Me.frmSubBookingsControl.Form!CancellationDate) Or IsNull(Me.frmSubBookingsControl.Form!CancellationContact) Or IsNull(Me.frmSubBookingsControl.Form!CancellationReasonID) Then
MsgBox "You require a date in the Cancellation Date field as well as a reason and a the name of the person who asked to cancel the booking."
ElseIf Me.frmSubBookingsControl.Form!StatusID <> 5 And Not IsNull(Me.frmSubBookingsControl.Form!CancellationDate) Then
MsgBox "If this booking is not cancelled - Please clear the Cancellation Date by returning the status to cancelled and then deleting the Cancellation Date before you can close this form"
ElseIf Me.frmSubBookingsControl.Form!StatusID = 5 And Not IsNull(Me.frmSubBookingsControl.Form!CancellationDate) Then
DoCmd.Close
End If
The idea is that if the user switches from cancelled (5) to uncancelled but doesn't clear the date field then it won't let you close the form - however it stops at the second if
please help! (maybe I require more sleep)