Hi,
I have the following code associated with the onclick property of a button that is (supposedly) designed to check if the Date box is empty and if it is brings up a message giving the user a choice of whether to accept the empty box or cancel the Close Form to allow them to update the record. If the Date box is not null i.e. it contains a date, clicking the button should close the form. This is where the problem lies. With the date field populated, 'pressing' the Close Form button does nothing, press it a second time and it closes
. Can anybody shed some light on this, it isn't a difficult function to implement surely but can i get it to work as i wish!!!
If IsNull(Me.DateofIssue) Then
If MsgBox("The Date of Issue is blank." & vbCrLf & _
"If that is ok - select OK, otherwise select Cancel and input the required Date of Issue.", vbOKCancel + vbExclamation, "No Date of Issue.") = vbCancel Then
Exit Sub
Else
DoCmd.Close
End If
End If
Many thanks
Alan
I have the following code associated with the onclick property of a button that is (supposedly) designed to check if the Date box is empty and if it is brings up a message giving the user a choice of whether to accept the empty box or cancel the Close Form to allow them to update the record. If the Date box is not null i.e. it contains a date, clicking the button should close the form. This is where the problem lies. With the date field populated, 'pressing' the Close Form button does nothing, press it a second time and it closes
If IsNull(Me.DateofIssue) Then
If MsgBox("The Date of Issue is blank." & vbCrLf & _
"If that is ok - select OK, otherwise select Cancel and input the required Date of Issue.", vbOKCancel + vbExclamation, "No Date of Issue.") = vbCancel Then
Exit Sub
Else
DoCmd.Close
End If
End If
Many thanks
Alan