How do you force a zero to appear first

david.paton

Registered User.
Local time
Yesterday, 16:14
Joined
Jun 26, 2013
Messages
338
I have some phone number fields on my form and living in Australia, our phone numbers appear as 04xx xxx xxx or (0x) xxxx xxxx. Whenever I try and enter the zeros first, it just disappears. How do I get them to stay there?
 
If you are not going to use the phone number any way numerically (e.g. add or subtract them) consider storing them as text.
 
Generally the recommended way is to use a text field.

BTW While the formats 04xx xxx xxx or (0x) xxxx xxxx are typical they are arbitrary. 4 is actually the area code for mobile and followed by eight digits just like the other numbers. The leading zero is the trunk access code and technically not part of the number.

An alternative is to store them as numbers and use the Format property to add the leading zero. Another variant is to store the area code separately from the number then concatenate and format them for display.
 
An alternative is to store them as numbers and use the Format property to add the leading zero. Another variant is to store the area code separately from the number then concatenate and format them for display.

Considering I already have entered about 550 records, I do not want to change it to text and enter them again so the option of making a leading zero sounds very appealing, how do I do this?
 
The more I read, the more it seems apparent that I can't have a leading zero in a number field. Is there a way to copy all the data from this number field to a new text field, if I was to create one?
 
You can change the field type to text without losing data. Or add a text field so you can compare before and after.

Then update the text field with Format([phonefield],"0000000000")
 
Alternative store a number and use this Format Property on the textbox:
"00 0000 0000"

The leading zero will appear and the spaces will be inserted. Put the parentheses in too if you want.

If you want to store text then you can update with different formats depending on if the number starts with 4.
 

Users who are viewing this thread

Back
Top Bottom