Results 1 to 9 of 9
  1. #1
    DTK0902 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Northern Ireland
    Posts
    10

    Question If Checkbox is ticked, Data Must be entered

    Hi all,


    Just another quick question, working through validation rules etc at the minute on my database. Have come across this one is sort of stumping me. I have a tick box in the field "Medication to be repeated" the next field after it is "Date to be repeated on". I am looking a validation rule which makes it that if the checkbox is ticked then date to be repeated must contain a valid date value.

    Regards,
    Daniel

  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,919
    Don't think can have an IIf conditional expression in ValidationRule. Need to handle with code in an event. Probably VBA, don't know if macro can handle.
    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
    DTK0902 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Northern Ireland
    Posts
    10
    Thanks June7 will do a bit of research into it, bound to have a book in work somewhere on VBA.

  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,919
    This thread suggests some references for VBA https://www.accessforums.net/program...hen-30362.html
    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
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'd use the form's before update event:

    http://www.baldyweb.com/BeforeUpdate.htm

    In your case, you'd only test the date field if the checkbox is true.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    DTK0902 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Northern Ireland
    Posts
    10
    Hi all and thanks for your replies. Managed to do a bit of Googleing and find that this can be validated by using a Record Validation Rule, a lot simpler than I first thought. Tested it and it works a charm.

    Thanks,
    Daniel

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Learn something new everyday. Never heard of Record Validation Rule. Is this in a Data Macro?
    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.

  8. #8
    DTK0902 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2012
    Location
    Northern Ireland
    Posts
    10
    If you view your table in Datasheet View, and select the field you want to apply the record validation rule to, two tabs should appear along the top row like in the picture below. Then select record data validation. Its pretty simple, below is my rule for in-date not before D.O.B.

    Regards,
    Daniel

    Click image for larger version. 

Name:	dbscreen.png 
Views:	6 
Size:	121.9 KB 
ID:	10191

    Click image for larger version. 

Name:	rule.png 
Views:	6 
Size:	60.1 KB 
ID:	10192

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Interesting feature, wonder if I can use it somewhere.

    Also accessible from the Design view property sheet.
    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: 2
    Last Post: 07-30-2012, 03:26 PM
  2. entered date of data
    By gsrikanth in forum Queries
    Replies: 1
    Last Post: 01-19-2012, 07:47 AM
  3. Automatic checkbox based on value entered in form
    By w00tage19 in forum Database Design
    Replies: 2
    Last Post: 07-12-2010, 04:20 AM
  4. Open report if checkbox is ticked
    By Patience in forum Reports
    Replies: 3
    Last Post: 06-23-2010, 08:34 AM
  5. Unmatched data entered with data in table
    By boreda in forum Access
    Replies: 0
    Last Post: 07-28-2006, 09:11 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