I have a form that doesn't have a Save button, but saves the record or any modifications to the record when the user hits a close button that dimply fires a DoCmd.Close on click event.
The problem is that one of the fields is needed in order to save the record. And if the user doesn't enter anything in that field, the form simply closes and doesn't save the record or any of the data that was input.
I would like to validate the form before it closes and then pop a message box about the field that needs to be filed.
I tried making the field mandatory in the table, but that isn't doing anything.
Then I tried the Before update of the form with this code, but that didn't do anything either:
If Nz(Me.Combo31, "") = "" Then
MsgBox "Please Enter something...!"
Cancel = True
Combo31.SetFocus
End If
Any ideas?
The problem is that one of the fields is needed in order to save the record. And if the user doesn't enter anything in that field, the form simply closes and doesn't save the record or any of the data that was input.
I would like to validate the form before it closes and then pop a message box about the field that needs to be filed.
I tried making the field mandatory in the table, but that isn't doing anything.
Then I tried the Before update of the form with this code, but that didn't do anything either:
If Nz(Me.Combo31, "") = "" Then
MsgBox "Please Enter something...!"
Cancel = True
Combo31.SetFocus
End If
Any ideas?