Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

leading zeros 1

Status
Not open for further replies.

digiduck

Programmer
Apr 4, 2003
95
US
is there a way to make a number field not remove the leading zeros in a number? like to keep it from keeping 065 and not changing it to 65?

Gone looking for myself. Should I arrive before I'm back, keep me here.
 
Hi

You could use Format(MyControl,"000").

But this question makes me think that you are using a number type for a column which should perhaps be a string. In my opinion you should use number types, only if they are 'arithmetic' columns, other columns (like say Order Number), which may contain only numbers but are not arithmetic, should be strings, with validation of formatting set appropriately to limit input to digits 0 thru 9.


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
How are ya digiduck . . . . .

Not only is KenReay in the post above correct, but numeric fields do not display leadings zero's, with theexception of decimal numbers.

What ever you do, formatting is your only way out, along with converting to string values.


TheAceMan [wiggle]

 
okay thanks all you've been very helpful


Gone looking for myself. Should I arrive before I'm back, keep me here.
 
digiduck!

You can use the general formula below:

strVal="0" & Ltrim(Str(YourNumber))

As an example,in a query, in and empty field, to the field line, you would add the following:

strNum:="0" & Ltrim(Str([YourNumberFieldName]))

Hope this helps a little more! Post back if you need more help.


TheAceMan [wiggle]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top