Setting Focus on field problem

Tiny bird

New member
Local time
Today, 19:55
Joined
Dec 13, 2001
Messages
9
Hi

I've got a form which the user must enter data in a field which is not required in the table.

The code I am using on Lost focus on the field is:

If IsNull(Me.[VouchersFor?]) Then
MsgBox "You must enter who the Voucher is for", vbCritical, "YOU HAVEN'T FINISHED THIS ENTRY"
Me.[VouchersFor?].SetFocus
End If

For some reason after bringing up the message it isn't setting the focus back on "VouchersFor?" field.

I've done this in other forms and it works okay. It just seems to be this field and this form.

Can anyone help me?!

[This message has been edited by Tiny bird (edited 12-15-2001).]
 
Try the BeforeUpdate
If IsNull(Me.VouchersFor?) Then
Cancel=True
MsgBox "You must enter who the Voucher is for", vbCritical, "YOU HAVEN'T FINISHED THIS ENTRY"
End If
You should also look at field naming conventions, having a question mark as part of a field name will almost certainly cause you problems. You can type whatever you want for a label, but field names require a little more care. Have a look at some of the responses given here for examples.
HTH
 

Users who are viewing this thread

Back
Top Bottom