I am working on a system I did not develop in Access 2010. A form (that was called by another form) generates an error when moving from any field that contains an On Lost Focus event.
The Access error message is: The expression On Lost Focus you entered as the event property setting produced the following error: User-Defined type not defined.
Here is the Private Sub FistName_LostFocus() code from one such field:
Reading elsewhere it seems that the desired method is to use BeforeUpdate/AfterUpdate. When I move the above code to a BeforeUpdate event and I leave the First Name blank I do not receive the message "Must enter First Name" but I receive an Access error: The expression Before Update you entered as the event property setting produced the following error: User-Defined type not defined.
Can anyone tell me
a) what is wrong with this code
b) what is the desired approach to edit checks of this nature
TIA for any help you can give.
The Access error message is: The expression On Lost Focus you entered as the event property setting produced the following error: User-Defined type not defined.
Here is the Private Sub FistName_LostFocus() code from one such field:
Code:
Private Sub FirstName_LostFocus()
If IsNull(Me!FirstName) Then
MsgBox "Must enter First Name"
Me!LastName.SetFocus
Me!FirstName.SetFocus
Else
Me!FirstName.Value = StrConv(Me!FirstName, vbProperCase)
End If
End Sub
Reading elsewhere it seems that the desired method is to use BeforeUpdate/AfterUpdate. When I move the above code to a BeforeUpdate event and I leave the First Name blank I do not receive the message "Must enter First Name" but I receive an Access error: The expression Before Update you entered as the event property setting produced the following error: User-Defined type not defined.
Can anyone tell me
a) what is wrong with this code
b) what is the desired approach to edit checks of this nature
TIA for any help you can give.
Last edited: