Results 1 to 6 of 6
  1. #1
    manic is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    63

    Check Boxes


    Hello All, I have a question about a form that I have.
    The Form that I have for work , has 10 questions and 10 check boxes to answer the questions. Now my question is the following: "Is there a way or a code that when the user clicks the save button access will check is there are at least 3 check box that have been selected, any three, just to prevent the user from saving a form with only one or two check boxes selected?
    Any help will be appreciated it.

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    There is use the beforeupdate event, and code something like this:

    Code:
    dim checks as integer
    checks=0
    if [checkbox1]=true then
    checks=checks+1
    endif
    if [checkbox2]=true then
    checks=checks+1
    endif
    if [checkbox3]=true then
    checks=checks+1
    endif
    if [checkbox4]=true then
    checks=checks+1
    endif
    if [checkbox5]=true then
    checks=checks+1
    endif
    if [checkbox6]=true then
    checks=checks+1
    endif
    if [checkbox7]=true then
    checks=checks+1
    endif
    if [checkbox8]=true then
    checks=checks+1
    endif
    if [checkbox9]=true then
    checks=checks+1
    endif
    if [checkbox10]=true then
    checks=checks+1
    endif
    if checks<3 then
    me.cancel=true
    msgbox "you must select at least 3 checks to continue"
    endif

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by R_Badger View Post
    ...use the beforeupdate event...
    BTW, that's the Form_BeforeUpdate event.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Thanks Missinglinq! I don't know where my head is today!

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I always add that because the newbies we usually see here frequently don't realize that the Form has its own BeforeUpdate event, and will insist on using one of the Control's events, instead!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    manic is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    63
    thanks guys, I appreciate the help.

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

Similar Threads

  1. Check Boxes
    By jordanturner in forum Access
    Replies: 1
    Last Post: 10-01-2010, 09:29 AM
  2. Yes/No check boxes
    By Desstro in forum Forms
    Replies: 2
    Last Post: 05-03-2010, 04:26 AM
  3. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  4. Un-Check all Boxes
    By cotri in forum Forms
    Replies: 4
    Last Post: 04-30-2010, 12:53 PM
  5. check boxes
    By chiefmsb in forum Forms
    Replies: 1
    Last Post: 11-14-2006, 02:22 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