Results 1 to 6 of 6
  1. #1
    phifer2088 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2013
    Posts
    9

    Do not add leading zeros


    Hello,

    I have a table and one of the entries requires a 10 digit number. I have added "0000000000" as the format, but in the form to populate the field if I only enter 6 digits it just adds leading zeros. How do I prevent this from happening? Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Formatting does not change the actual data. The value should still be only the 6 digits entered. Remove the format setting and see what happens.

    If you don't want to see leading zeros, why set the format?

    If you are actually talking about Input Mask, that is a different issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    phifer2088 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2013
    Posts
    9
    Because I need to require that the all 10 digits of the ID is entered. If they only enter 9 I need the database to not accept the input.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You can use Valdiation Rules to require a specific length.
    Check out thus link here: http://allenbrowne.com/ValidationRule.html
    Note that the rule is different, depending on the Data Type of your field (if it is Text or Numeric).

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You seem to be contradicting yourself here -

    In your first post, you said you don't want to see leading zeros, but in post #3 you said you said that you need to ensure that all 10 digits are needed on input. You can't really have it both ways.

    The easiest way to ensure 10 digits are entered is to use an input mask : "0000000000" ensures that 10 digits (ond only 10, with no blanks or +/-) are entered.

    Is the data type in the table Text? It should be, if leading zeros and required length are an issue.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You want users to input 10 digits but would leading zeros be valid input - like 0327654209?

    Is this a text or number type field?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Trying to get leading zeros to show
    By Pegasus_Angel in forum Access
    Replies: 3
    Last Post: 10-25-2012, 11:40 AM
  2. Importing data with leading zeros
    By buckychudd in forum Import/Export Data
    Replies: 7
    Last Post: 11-04-2011, 12:26 PM
  3. Leading Zeros
    By dirtbiker1824 in forum Access
    Replies: 1
    Last Post: 03-14-2011, 02:16 PM
  4. Adding Leading Zeros
    By jo15765 in forum Access
    Replies: 13
    Last Post: 11-20-2010, 11:11 PM
  5. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 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