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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Query to CSV without losing leading Zeros

Status
Not open for further replies.

Vette00

Programmer
Oct 8, 2006
21
US
I am trying to export a query to a CSV. The problem is the two fields are not exporting correctly.

I have an Employee ID Field that has 5 numbers but some employees have ID like 00426 and 00527 but are being exported as 426 and 527.

Also there is an hours field that should read 0800 for 8 hours and 0050 for 1/2 hour. Again the leading zero's are not exporting
 
Hi,

If your field data type is numeric, including Date/time, you will not get leading zeros. BTW, 0800 is not a time, neither is [/b]00426[/b] a number. Then are both STRINGS of characters, albeit digits.

You might need to use the Format function to return strings for the numbers in your columns.
Code:
msgbox function([EmplID],"00000")
msgbox function([YourTime]*100,"0000")


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top