Results 1 to 7 of 7

Checkbox

  1. #1
    1Christmas2 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2012
    Posts
    6

    Checkbox

    Can someone please provide code for the following?



    I have a form named 'frm_ScheduleChanges' with about 15 fields and 5 of those fields are checkboxes. When the form opens I'm hoping to have the checkbox field named 'ALT_Pending' automatically uncheck if the date field named 'Request_Date' is more than 21 days ago and subsequently I want the field named 'CCP_Declined' to automatically become checked but only if the 'ALT_Pending' was automatically unchecked by the VBA code. And then do this for each record.

    In other words: If 'Request_Date' is at least 21 days ago AND 'ALT_Pending' is checked THEN uncheck 'ALT_Pending' AND check 'CCP_Declined'

    I'm not the most experienced Access user and even less experienced with VBA...so if there's something else needed just let me know.

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,349
    Is it possible for ALT_Pending and CCP_Declined to both be checked for the same record? These checkboxes are bound to fields in table? Are users allowed to change the checkbox values?
    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
    1Christmas2 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2012
    Posts
    6
    Yes, it's possible for 'ALT_Pending' and 'CCP_Declined' to both be checked for the same record. Technically we would never want them to both be checked at the same time but there's nothing preventing it from happening. I've never really understood the term bound but I think the answer is yes because when I try to open the table in design view while the form is open it gives me this message "Either an object bound to table 'tbl_ScheduleChanges' is open or another user has the table open. Do you want to open the table as read-only"...hope that helps. Yes, the users are allowed to change the checkbox values.

    One other thing I forgot to mention is that there is a sub form in 'frm_ScheduleChanges' named 'frm_SUB_ScheduleChanges'....in case that matters.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,349
    Doesn't really answer my questions. Should both checkboxes EVER be checked for the same record? Should this be prevented? If both checkboxes should never be checked at same time, then this design is not suitable.

    A bound form has a RecordSource. A bound control has a ControlSource that is a field of the form's RecordSource. So, are the checkboxes 'bound'?

    I don't know if the subform is relevant to this 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.

  5. #5
    1Christmas2 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2012
    Posts
    6
    No, both checkboxes should never be checked for the same record. Yes, this should be prevented if possible. Thanks for the clarifying the bound/unbound for me....Yes, the checkboxes are bound.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,349
    Then suggested options:

    1. Text field and combobox (or listbox) with only two value choices: Pending, Declined

    2. A single Yes/No field. Yes means Pending, No means Declined or vise versa. Use an OptionGroup control that has two radio buttons. Only one button in the OptionGroup can be clicked.

    3. Don't have fields for the Pending/Declined status. Calculate the Pending or Declined status when needed. It is this calculation that would have to be done anyway to determine which checkbox should be checked.
    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
    1Christmas2 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2012
    Posts
    6
    Ok, thanks!

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

Similar Threads

  1. Checkbox
    By huongdl1987 in forum Forms
    Replies: 1
    Last Post: 06-23-2011, 05:29 PM
  2. QBF - Checkbox
    By radink in forum Queries
    Replies: 17
    Last Post: 04-19-2011, 03:47 PM
  3. Checkbox
    By Patience in forum Access
    Replies: 5
    Last Post: 06-22-2010, 05:37 AM
  4. Using a checkbox help
    By gbjc105 in forum Forms
    Replies: 1
    Last Post: 01-28-2010, 08:27 PM
  5. checkbox
    By Suresh in forum Forms
    Replies: 0
    Last Post: 12-19-2007, 01:30 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
  •  
Tech Forums: Microsoft Office Forums