B
BWD
Hello Group
I have a form with a field that is used to add records to a table.
The first field on the form is the Primary key. I wrote a snippet of
code on the lost focus event that checks the value of the PK field to
make sure it is not null. However, the code does not seem to work and
keeps producing a Run Time Error "424: "Object Required".
Here is the code:
Private Sub Customer_Number_LostFocus()
Dim x As Variant
Set x = Me.Customer_Number (**This is the PK field)
'check to be sure that the customer # field has a value
If x = Null Then
MsgBox "You must enter a customer #", vbOKOnly, "Enter a Customer
#"
End If
End Sub
Any help appreciated!!
I have a form with a field that is used to add records to a table.
The first field on the form is the Primary key. I wrote a snippet of
code on the lost focus event that checks the value of the PK field to
make sure it is not null. However, the code does not seem to work and
keeps producing a Run Time Error "424: "Object Required".
Here is the code:
Private Sub Customer_Number_LostFocus()
Dim x As Variant
Set x = Me.Customer_Number (**This is the PK field)
'check to be sure that the customer # field has a value
If x = Null Then
MsgBox "You must enter a customer #", vbOKOnly, "Enter a Customer
#"
End If
End Sub
Any help appreciated!!