RobertIngles
Technical User
I have set the required property to "Yes" in the table design.
If the field is null and user clicks the close form button, Access msg pops up and informs the user that the field is required but then shows a msg that the record cannot be saved at this time because the field is null and closes the form.
I want to have the user returned to the form field to correct the mistake by populating the require field.
Can this be done from the table design or do I have to code it. I tried to set the required property in the table to "No" and placed the following code in the BeforeUpdate property of the form but it did not work. The form closed saving the form without all the required information:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.LocationID = Null Then
MsgBox "LocationID Cannot be Null", vbOKCancel
Me.[BookingDate] = Now()
End If
End Sub
Thanks for your help!
If the field is null and user clicks the close form button, Access msg pops up and informs the user that the field is required but then shows a msg that the record cannot be saved at this time because the field is null and closes the form.
I want to have the user returned to the form field to correct the mistake by populating the require field.
Can this be done from the table design or do I have to code it. I tried to set the required property in the table to "No" and placed the following code in the BeforeUpdate property of the form but it did not work. The form closed saving the form without all the required information:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.LocationID = Null Then
MsgBox "LocationID Cannot be Null", vbOKCancel
Me.[BookingDate] = Now()
End If
End Sub
Thanks for your help!