Validateing a txtbox from form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has textbox txtAN after the cmbbutton is clicked I want to verify that the information in the txtAN box is 5 numbers. It has to be 5 number no more/no less and no alpha charecters. How do you make this check occure

If txtAN < 5 Then GoTo errmsgbx Else I started with this but this is not correct. Any help would be great thanks.
 
If Len(txtAN.Text) = 5 Then
For i = 1 to 5
If Not Isnumeric(Mid(txtAN.Text,i,1)) Then
Msgbox "Invalid"
eND iF
Next i
Else
MsgBox "Invalid"
End If

You could trap the input and only allow numbers and only allow 5.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Lou said:
I have a form that has textbox txtAN after the cmbbutton is clicked I want
to verify that the information in the txtAN box is 5 numbers. It has to be 5
number no more/no less and no alpha charecters. How do you make this check
occure.
If txtAN < 5 Then GoTo errmsgbx Else I started with this but this is not
correct. Any help would be great thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top