Results 1 to 5 of 5
  1. #1
    oriels is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2015
    Posts
    4

    Restrict "number" field to 6 digits |Access 2013

    Hi
    How can i restrict a field of type "number" to 6 digitis at the most? i need it with leading zeros.
    Thank You .!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Can you tell readers why this particular format is needed?
    Numbers don't normally have leading zeros. You can put a format(yourNumber) but it will result in a string data type.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    A number type field will not retain leading zeros. You can format a number to display leading zeros but will not be stored.

    You can try an Input Mask as well as Validation Rule.
    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.

  4. #4
    oriels is offline Novice
    Windows 8 Access 2013
    Join Date
    Dec 2015
    Posts
    4
    ID, but i was demanded for a number type.

    I made design template and set it to "000000" I also make validation rule to <999999 so it work fine.
    there is any way to make it with a better way?

    Another problem that I noticed is when i put ######.# it makes it good so I see "######" but if I want to restrict for just exact 6 digits without allow "." (dot). does it possible?
    Thank you a lot!!!
    Quote Originally Posted by June7 View Post
    A number type field will not retain leading zeros. You can format a number to display leading zeros but will not be stored.

    You can try an Input Mask as well as Validation Rule.
    Input Mask are not allowed in number type.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The field type should be set as Integer or Long Integer to prevent decimal.

    Can use VBA behind the textbox to do validation. The BeforeUpdate event is commonly used for this.
    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. Replies: 3
    Last Post: 04-29-2015, 08:25 AM
  2. Replies: 7
    Last Post: 09-20-2014, 06:48 PM
  3. Replies: 0
    Last Post: 08-11-2014, 12:25 PM
  4. Replies: 2
    Last Post: 04-19-2014, 02:42 AM
  5. Replies: 5
    Last Post: 03-22-2013, 01:11 PM

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