G
Guest
Hi all,
in a form I have a textbox which data type is number, integer. If the user
tries to write something different ftom a number, he gets the standard pop up
message 'the value you entered isn't valid for this field', while the msgbox
that I put in the beforeupdate event it is not executed. Here's the code:
----------------- code begins here -----------------
Private Sub medNum_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_medNum_BeforeUpdate
If Not IsNumeric(medNum) Then
MsgBox " The Num field can contain a number between 1 and 400. ",
64, "Wrong data type"
Me!medNum.SetFocus
Cancel = True
End If
Exit_medNum_BeforeUpdate:
Exit Sub
Err_medNum_BeforeUpdate:
MsgBox "errore rilevato: " & Err.Number & ", " & Err.Description
Resume Exit_medNum_BeforeUpdate
End Sub
----------------- code ends here -----------------
is there a way to prevent the standard message to appear, so to give a
chance to my message to appear?
Many thanks
Massimo
in a form I have a textbox which data type is number, integer. If the user
tries to write something different ftom a number, he gets the standard pop up
message 'the value you entered isn't valid for this field', while the msgbox
that I put in the beforeupdate event it is not executed. Here's the code:
----------------- code begins here -----------------
Private Sub medNum_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_medNum_BeforeUpdate
If Not IsNumeric(medNum) Then
MsgBox " The Num field can contain a number between 1 and 400. ",
64, "Wrong data type"
Me!medNum.SetFocus
Cancel = True
End If
Exit_medNum_BeforeUpdate:
Exit Sub
Err_medNum_BeforeUpdate:
MsgBox "errore rilevato: " & Err.Number & ", " & Err.Description
Resume Exit_medNum_BeforeUpdate
End Sub
----------------- code ends here -----------------
is there a way to prevent the standard message to appear, so to give a
chance to my message to appear?
Many thanks
Massimo