Results 1 to 8 of 8
  1. #1
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107

    Validation Rule

    I only want the user to be able to enter 9 numbers into the field including 0 in the beginning if needed.


    I have this code in at the moment "Is Null OR Between 100000000 And 999999999", however if the number starts with a 0, it doesnt include it.
    Any suggestions?

    Else I'll just use an Input Mask

    Wayne

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Number field will not save leading zeros. The field must be a text datatype then try InputMask property. Caution with number data in text fields: sort will be alpha not numeric. If values are not same length, results can be unsatisfactory.
    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
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    I'm aware of that thanks

    Just wanted to know if there was a way doing it as a Validation rule?

    Thanks

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If they are allowed leading zero which means they are permitted 8 or 9 digits then that would be a range of 10000000 to 999999999?

    What is this data for? Is this really a number or some sort of identifier like SSN or phone number or serial number?
    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.

  5. #5
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    its for a serial number. If i type a "0" first, it falls away once I leave the field. How do i keep it?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Make field a text datatype and use input mask that requires character in every position.
    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.

  7. #7
    WayneSteenkamp is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    107
    Ok,No problem. Hopefully wont interfer too much with my relationships.

    Thanks June7

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You have relationships based on this data? Will have to change field datatype on both sides. Also, if you already have 8-character values, will probably want to correct to 9 with leading zeros.
    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. IIf in Validation Rule
    By Bugsy in forum Access
    Replies: 6
    Last Post: 11-21-2011, 11:33 AM
  2. Validation Rule
    By Darkladymelz in forum Reports
    Replies: 2
    Last Post: 09-15-2011, 07:43 AM
  3. Validation Rule
    By rbiggs in forum Forms
    Replies: 4
    Last Post: 08-23-2011, 05:24 PM
  4. Validation Rule
    By ritzzy in forum Access
    Replies: 1
    Last Post: 04-13-2011, 01:33 PM
  5. Validation Rule
    By robomose in forum Access
    Replies: 1
    Last Post: 09-09-2009, 05:59 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