Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have an Access query that I am trying to export as CSV format. The leading zero is being dropped in several text fields containing numerical input. How can I prevent that from happening?
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts
    You will probably need to put a format statement to explicitly convert them to text to get leading zeros. You can use either the CStr() function or the Format() function. You could also try creating an Export Specification and specify those fields as text fields, but I've had mixed results doing that.
    Wendell

  3. #3
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    What did you use to look at the CSV file?

    If it was EXCEL then it has a nasty habit of being annoyingly clever and converting to numbers.

    Have you checked the CSV file in Notepad to what is happening there?

    I just tested one here, the leading zeros are fine in Notepad, but stripped by Excel.

    "MS Bless them".
    Andrew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •