I have a form that contains a subform. If the user has selected to enter a new record, but does not enter anything on the new record, when they click on the subform which contains a list of their records they recieve an error message "The field'Entries.Subject' cannot contain a Null Value because the Required property for this field is set to True. Enter a value in this field."
Basically, I want to write a code that if the Main form loses focus, and the subject field is Null, do not save the record and do not prompt the user with validation rules.
Any idea on how to do that? I am a newbe at Access, and the Code I have put together (which is probably very wrong) so far is below:
Private Sub Form_LostFocus()
IF DatRequest.EditMode = dbEditAdd Then
If DatRequest.recordset("Subject").Value="" Then
DatRequest.Recordset.Quit
Else
DatRequest.Recordset.Save
End if
Endif
EndSub
Thanks in Advance.
Basically, I want to write a code that if the Main form loses focus, and the subject field is Null, do not save the record and do not prompt the user with validation rules.
Any idea on how to do that? I am a newbe at Access, and the Code I have put together (which is probably very wrong) so far is below:
Private Sub Form_LostFocus()
IF DatRequest.EditMode = dbEditAdd Then
If DatRequest.recordset("Subject").Value="" Then
DatRequest.Recordset.Quit
Else
DatRequest.Recordset.Save
End if
Endif
EndSub
Thanks in Advance.