counting Charaters

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I have some code that i want to use depending on how many charaters
have been enterer into txtBox

for examples

If txtBox has 8 characters then do follwoing code ........
If txtBox has 3 character then do this codes.........


I just do not know how to code it to count the charaters in a txt box
 
Simon said:
I have some code that i want to use depending on how many charaters
have been enterer into txtBox

for examples

If txtBox has 8 characters then do follwoing code ........
If txtBox has 3 character then do this codes.........


I just do not know how to code it to count the charaters in a txt box


The Len() function will tell you how long the text is:

Select Case Len(Me!txtBox & vbNullString)
Case 8
' Handle 8-character case
Case 3
' Handle 3-character case
Case Else
' Not 8 or 3; what now?
End Select

The reason for the "& vbNullString" is to force the value to a zero-length
string if it happens to be Null.
 
Back
Top