Results 1 to 9 of 9
  1. #1
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376

    Check Boxes

    Hello All,


    I haven't been here for a while but most likely will be for some time as I am working on a new database and haven't done so in a couple of years.

    My issue right now is I have 2 check Boxes on a form and I want them to work such that if 1 is checked the other is not checked and vice versa.

    Here is what I thought would work but it doesn't.

    'If Hourly = -1 Then
    ' Salary = 0
    'End If
    '
    'If Salary = -1 Then
    ' Hourly = 0
    'End If


    I have also tried

    'If Hourly = True Then
    ' Salary = False
    'End If
    '
    'If Salary = True Then
    ' Hourly = False
    'End If



    Thanks in advance
    Dave

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    why not use an option control instead? Or just one checkbox - hourly=0, salary=-1

    But if you want to store two value rather than one

    in the salary checkbox afterupdate event put

    hourly=not salary

    in the hourly checkbox afterupdate event put

    salary=not hourly

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Or put the checkboxes in an option group (frame) and they'll behave the same as option buttons - no code for setting T/F?
    But maybe that is what was meant by an "option control"...
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    CJ_London,
    I tried your suggestion and it doesn't work, I get an Error "Microsoft Access cannot find the Object "Salary=Not Hourly"

    Micron, I have never used a frame before

  5. #5
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    Can't this be done with an If statement?

  6. #6
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    Got it Resolved, Thanks

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Learn Something new everyday. A day in which you learn nothing is a wasted day.
    You can help someone who comes across this in the future to do that by always posting your solution.
    Thanks.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Do you have two yes/no fields - Salary and Hourly? Why not 1 text field and a combobox with choices of S or H? Or one yes/no field as suggested by CJ?
    Last edited by June7; 09-14-2022 at 01:41 AM.
    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.

  9. #9
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    But maybe that is what was meant by an "option control"...
    yes - was on my phone at the time

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

Similar Threads

  1. Replies: 2
    Last Post: 10-07-2020, 10:30 AM
  2. Replies: 5
    Last Post: 02-07-2020, 11:21 PM
  3. Replies: 5
    Last Post: 10-09-2017, 07:19 AM
  4. Check all check boxes on continuous form
    By NISMOJim in forum Forms
    Replies: 7
    Last Post: 06-14-2016, 02:14 AM
  5. Check box based on values of other check boxes?
    By Michael.Reynolds1775 in forum Forms
    Replies: 3
    Last Post: 03-25-2015, 12:58 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