Connecting Tech Pros Worldwide Forums | Help | Site Map

Check the first character if its not zero then insert otherwise not

colleen1980@gmail.com
Guest
 
Posts: n/a
#1: Sep 5 '06
Can any one please help me how to i check the first character in a
variable. If user dont put 0 in the start of a variable the program
automatically insert zero before the number otherwise not.

mynumber=1234-6565-75 of type text

will be
mynumber=01234-6565-75

Thanks,


salad
Guest
 
Posts: n/a
#2: Sep 5 '06

re: Check the first character if its not zero then insert otherwise not


colleen1980@gmail.com wrote:
Quote:
Can any one please help me how to i check the first character in a
variable. If user dont put 0 in the start of a variable the program
automatically insert zero before the number otherwise not.
>
mynumber=1234-6565-75 of type text
>
will be
mynumber=01234-6565-75
>
Thanks,
>
In the AfterUpdate event of the field, do something like
If Left(Me.FieldName,1) <"0" THen
Me.FieldName = "0" & Me.FieldName
Endif

You could also use an input mask. Open up the property sheet and go to
the Data tab. Click on Input mask and press the F1 key.

Closed Thread