Results 1 to 4 of 4
  1. #1
    Benj is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    May 2018
    Posts
    33

    error message


    Am trying to place an error message that if a date is entered incorrectly (either more older than birthday or recent than leaving date) it wont go to the next field if you presss OK. Just like if you entered a non-date on a date field. Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Options:

    1. ValidationRule and ValidationText properties of the control

    2. VBA code in control's BeforeUpdate event
    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
    Benj is offline Advanced Beginner
    Windows 7 32bit Access 2016
    Join Date
    May 2018
    Posts
    33
    Quote Originally Posted by June7 View Post
    Options:

    1. ValidationRule and ValidationText properties of the control

    2. VBA code in control's BeforeUpdate event

    Thanks for the reply! I tried using the ValidationRule, am not sure whats wrong with this, but it gives me the validation rule error everytime i enter a date on PigletDate:
    IIf(IsNull([Forms]![Main]![FarrowingDate]),[PigletDate]<=[Forms]![Main]![WeanDate],[Forms]![Main]![FarrowingDate]<=[PigletDate]<=[Forms]![Main]![WeanDate])

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Don't use IIf(). https://support.office.com/en-us/article/Restrict-data-input-by-using-validation-rules-B91C6B15-BCD3-42C1-90BF-E3A0272E988D

    The expression really makes no sense anyway as it is not proper syntax for an IIf().
    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: 1
    Last Post: 07-26-2016, 06:34 AM
  2. Replies: 7
    Last Post: 03-17-2016, 05:53 PM
  3. Replies: 5
    Last Post: 05-15-2015, 10:49 AM
  4. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  5. Replies: 2
    Last Post: 06-23-2012, 11:59 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