I have a text box that is used to enter a customers name.I have this code on the lostfocus event : If Len(Me.Customer) > 0 Then
MsgBox "message"
Cancel = True
Me.Undo
End if
This works ok except after the ok button is clicked it doesn't return to the customer text box.
I also have the following code in the Beforeupdate event :
If DCount("Customer", "Table6", "Customer=""" & Forms!Form8!customer & """") = 0 Then
MsgBox "Customer already exist", , "Duplicate Error"
Cancel = True
Me.Undo
End If
This also works fine and returns to the customer text box after clicking the ok button.
My questions are is there a way to combine this code into the beforeupdate event or is this the best way to do it, If it is the best way to do it how can i make the lostfocus event return to the correct text box.
Thanks in advance.
MsgBox "message"
Cancel = True
Me.Undo
End if
This works ok except after the ok button is clicked it doesn't return to the customer text box.
I also have the following code in the Beforeupdate event :
If DCount("Customer", "Table6", "Customer=""" & Forms!Form8!customer & """") = 0 Then
MsgBox "Customer already exist", , "Duplicate Error"
Cancel = True
Me.Undo
End If
This also works fine and returns to the customer text box after clicking the ok button.
My questions are is there a way to combine this code into the beforeupdate event or is this the best way to do it, If it is the best way to do it how can i make the lostfocus event return to the correct text box.
Thanks in advance.