count value

  • Thread starter Thread starter ياسر
  • Start date Start date
Ù

ياسر

i have a form that contain the following :
ID number ----- text field size = 14
Name ---------- text
and other fields
i need to count how many numbers have been inserted in the text box named
ID number and not accept if less than 14 digit.
just 14 digits only to accept filling the id number field
example:
id number : 22222222222222 = 14 digit
accept this
id number : 22222222 = 8 digit
not accepted
must be 14 digit
so what do i have to do ?
 
i have a form that contain the following :
ID number ----- text field size = 14
Name ---------- text
and other fields
i need to count how many numbers have been inserted in the text box named
ID number and not accept if less than 14 digit.
just 14 digits only to accept filling the id number field
example:
id number : 22222222222222 = 14 digit
accept this
id number : 22222222 = 8 digit
not accepted
must be 14 digit
so what do i have to do ?

Code the Form's BeforeUpdate event:

If Len(Me.[ID]) <> 14 Then
MsgBox "You need to enter exactly 14 characters."
Cancel = True
Me.[ID].SetFocus
End If

If the number of characters is not exactly 14 a message will display
and the focus will be returned to the [ID] control.
 
Hi,

the easiest way is to put an input mask on the ID number field with 14 zero's.
00000000000000 allows only 14 digits not less, not more...
No programming required there.
 
Back
Top