Results 1 to 13 of 13
  1. #1
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338

    Check box

    Hello

    I have a form with four check boxes. I would like if the user check's off one, than all other check boxes get checked off automatically. How can i do this???



    Thank you

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Copy this code to the forms code module:
    Code:
    Public Sub AllOptionSame(bln As Boolean)
      Me.Check0 = bln
      Me.Check2 = bln
      Me.Check4 = bln
      Me.Check6 = bln
    End Sub
    Replace the Check0 Check2 Check4 Check6 with the names of your check boxes.

    Put this line of code in the After Update Event of each of the check boxes
    Code:
      Call AllOptionSame(Me.ActiveControl.Value)
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Bob
    Thank your for your reply. I'm getting this error in forms code modules
    Public Sub AllOptionSame(bln As Boolean)
    Me.Cash Cleared = bln
    Me.Check Cleared = bln
    Me.Credit Card Cleared = bln ( Compile error: Expected: end of statement )
    Me.All Cleared = bln
    End Sub

  4. #4
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Bob
    Not sure if i ask the questions the right why. If the user checks off check box All Cleared than all other three check boxes would be checked off.


    Thank you

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    I think the problem is that you have spaces in your field names. Try this:
    Code:
    Public Sub AllOptionSame(bln As Boolean)
    Me.[Cash Cleared] = bln
    Me.[Check Cleared] = bln
    Me.[Credit Card Cleared] = bln 
    Me.[All Cleared] = bln
    End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    I put the code and it still didn't work. I took off the space and now i'm getting this error Compile error: Method or data member not found.

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Can you post a copy of your db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Reconciliationzip.zip
    This db doesn't have space.

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    The problem was caused by the spaces. The solution I offered, using the square brackets, failed because one of the control names had a double space.
    So,
    Me.[Cash Cleared] = bln
    needed to be
    Me.[Cash Cleared] = bln

    Take a look at the attached db and let us know if this is now working as required.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Thank you its working. Now the only time that i want it to check off all of them is when All cleared is checked off. If i check off cash than that's the only one that is check off.

  11. #11
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Remove this line of code:
    Call AllOptionSame(Me.ActiveControl.Value)
    from the After Update event of each of the check boxes except the "All Cleared" check box.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  12. #12
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Thank you very much it worked great.

  13. #13
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Glad to help.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 1
    Last Post: 05-10-2012, 11:56 AM
  2. yes/no check box
    By Justin Warner in forum Access
    Replies: 1
    Last Post: 02-06-2012, 03:24 AM
  3. Check Box
    By BLD21 in forum Forms
    Replies: 1
    Last Post: 11-07-2011, 10:11 AM
  4. Check for no value
    By jgelpi16 in forum Programming
    Replies: 12
    Last Post: 07-29-2010, 02:53 PM
  5. 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

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