Results 1 to 10 of 10
  1. #1
    mulefeathers is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    39

    Chart report leading zeros

    I have created a chart report based on a query that tracks the top 5 most expensive part numbers. The query returns the part numbers as they are and correct. Since some part numbers have both text and numbers, the field is formatted as text. when I preview the chart all leading zeros are removed even through they appear in the query.



    Why and how do I fix this problem.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The rule-of-thumb is "unless you will be performing math on the number, make it a text field". It sounds like somewhere you (or Access) have declared the value as numeric where leading zeros make no sense and are removed.

  3. #3
    mulefeathers is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    39
    As stated the fields are formatted as a text field. No math is being done. It is straight forward the table where the query gets the information from is imported from an excel file. The query returns the correct number the chart does not.

    What type on an instance would access change a field type?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Access likes to import numbers from Excel as a number. It could be the chart is forcing the value to a number. Try adding an _UnderScore to the beginning of the value in the query and see what happens.

  5. #5
    mulefeathers is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    39
    Adding _ lets me see the zeros but it the part number now has a _ in the chart. So that wont work, but thanks anyway.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about prepending a " "?

  7. #7
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    what I do when I need leading zeros is exporting to excel, formatting as needed, and making sure the first line contains some text. for example:
    ProdID
    test
    001
    002
    003

    Now when you import back, Access will see "test" as the first entry and treat the column as text. Then I go in and delete the record containing "test". its a quick and dirty way i use to fix it.

  8. #8
    mulefeathers is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    39
    I see the work around and that may be what I have to do, but I still would like to know why it is only happening in chart view. The part number column is formatted as text in the excel file as well as the table in access. The query returns the part numbers correctly including the leading zeros. It is only when I view it as a chart. The report that pulls from the same query (same set up it just returns all results not just the top five) displays the information correctly.

    Anyway thanks for all the help.

    As far the text most part number start with letters such as RF-123423456 so it should already recognize the text.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As I implied in post #2, it is probably the Chart (and therefore Access) that it helping just a bit too much. Have you applied all of the Service Packs and HotFixes? That may have been fixed already.

  10. #10
    mulefeathers is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    39
    Quote Originally Posted by RuralGuy View Post
    As I implied in post #2, it is probably the Chart (and therefore Access) that it helping just a bit too much. Have you applied all of the Service Packs and HotFixes? That may have been fixed already.
    I will check and make sure we are up to date. Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 04-30-2010, 01:57 PM
  2. Pie Chart Design for Report
    By maggioant in forum Reports
    Replies: 0
    Last Post: 10-13-2009, 03:06 PM
  3. Getting rid of zeros
    By ceb39 in forum Reports
    Replies: 26
    Last Post: 05-31-2009, 12:49 PM
  4. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 AM
  5. Leading Zeroes
    By FREEEEEEDOM in forum Access
    Replies: 2
    Last Post: 04-06-2009, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums