textbox entry error

  • Thread starter Thread starter Tom D
  • Start date Start date
T

Tom D

Hi I have been trying to use something like the following
code to validate a textboxes entry to ensure that the
contents are all of numbers and no more than six
characters long. Please could somone tell me how to do
this.

I need to supress the error message saying "Value not
valid for this field" And only get the message as showing
in my code.

I have been trying to get this from the before update
event.

If anyone knows the error number for the "value not vali
for this field" then let me know and I can cover this in
the onerror event of the form!

If Me.txtreading = "######" Then
MsgBox ("please enter a value with no more than six
characters")
End If

Thanks

Tom
 
Hey Tom,

Try:

If Len(Me.txtreading) > 6 Then
MsgBox ("please enter a value with no more than six Characters ")
End If

Len is a function that checks the length of a string.

Evan
 
Back
Top