G
Guest
Hi all,
I need to make sure that the user types a valid number in the first textbox
of the form used to insert new records.
In the lostfocus event of that textbox, I've written the following:
Private Sub medNum_LostFocus(Cancel As Integer)
If Me!medNum = "" Or IsNull(Me!medNum) Then
MsgBox "The number field must contain a valid number.",
vbExclamation, "Type a valid number"
Me!medNum.SetFocus
End If
End Sub
The problem is that the focus still goes at the following textbox, the set
focus line does not work.
I've tried to put the same code in the Exit event, but does not solve.
Any idea?
Many thanks
Massimo
I need to make sure that the user types a valid number in the first textbox
of the form used to insert new records.
In the lostfocus event of that textbox, I've written the following:
Private Sub medNum_LostFocus(Cancel As Integer)
If Me!medNum = "" Or IsNull(Me!medNum) Then
MsgBox "The number field must contain a valid number.",
vbExclamation, "Type a valid number"
Me!medNum.SetFocus
End If
End Sub
The problem is that the focus still goes at the following textbox, the set
focus line does not work.
I've tried to put the same code in the Exit event, but does not solve.
Any idea?
Many thanks
Massimo