Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    NJTrucker is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    6

    Can a Check box get info from a combo box

    I have a combo box to select if a person is working in a region or if they are terminated
    and i have a check box for active or not



    what i would like to do is have the check box unchecked if they are terminated and check for the other 4 regions

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Shouldn't be too difficult.
    What do you have as the Row Source property of the combo?
    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
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    You can put a formula in the checkbox control source. If you are talking about a multi select combo, you can probably write some code but not enough info to suggest anything

  4. #4
    NJTrucker is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    6
    a table with
    Regions NE, ME, SE, MW, & Terminated

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by NJTrucker View Post
    a table with
    Regions NE, ME, SE, MW, & Terminated
    Can you copy and paste what's in the setting
    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
    NJTrucker is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    6
    Quote Originally Posted by Bob Fitz View Post
    Can you copy and paste what's in the setting


    the combo box has this code, as is also shows / hides a 2 date fields


    Private Sub Region_AfterUpdate()
    UpdateAgent

    Select Case Me.Region
    Case "1"
    Me.HireDate.Visible = True
    Me.TerminationDate.Visible = False
    Case "2"
    Me.HireDate.Visible = True
    Me.TerminationDate.Visible = False
    Case "3"
    Me.HireDate.Visible = True
    Me.TerminationDate.Visible = False
    Case "4"
    Me.HireDate.Visible = True
    Me.TerminationDate.Visible = False
    Case "5"
    Me.HireDate.Visible = False
    Me.TerminationDate.Visible = True
    End Select
    End Sub

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Code:
    =[TerminationDate] Is Null
    as the control source expression.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    For this to work, Region must be an option group control.
    You can simplify your code. Also remove the quotes, as value is numeric.
    Code:
    Select Case Me.Region.Value
       Case 1, 2, 3, 4
          Me.HireDate.Visible = True
          Me.TerminationDate.Visible = False
       Case 5
          Me.HireDate.Visible = False
          Me.TerminationDate.Visible = True
    End Select

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why would Region have to be an OptionGroup?
    Include number field in combobox RowSource.
    Assuming there is an ID field with values 1 thru 5: SELECT ID, Region FROM Regions;
    Since code shows Region with numeric values, my guess is that is the setup.
    Or use Region text values in code.

    A combo could be multi-select only if bound to a multi-value field. Hope that's not the case.

    Even simpler:
    With Me
    .HireDate.Visible = .Region <> 5
    .TerminationDate.Visible = .Region = 5
    End With

    Or in place of 5 use "Terminated".

    Use Welshgasman's expression for checkbox ControlSource: =[TerminationDate] Is Null
    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.

  10. #10
    NJTrucker is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    6
    Quote Originally Posted by davegri View Post
    For this to work, Region must be an option group control.
    You can simplify your code. Also remove the quotes, as value is numeric.
    Code:
    Select Case Me.Region.Value
       Case 1, 2, 3, 4
          Me.HireDate.Visible = True
          Me.TerminationDate.Visible = False
       Case 5
          Me.HireDate.Visible = False
          Me.TerminationDate.Visible = True
    End Select

    this is a little better then my current code. and look nice, but what I'm trying to do - is have a check box set to false if option 5 is selected and true if 1,2,3,4 are selected

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Did you see posts 7 and 9? Checkbox need not be dependent on combobox.
    Until there is a value in TerminationDate, checkbox should be True.
    Really don't need "Terminated" value for Region. This is actually redundant because of TerminationDate field. Could leave with the last assigned region or Null. Code could change Region value when a TerminationDate is entered, even to set field to "Terminated". Not reliant on user to select "Terminated" in combobox.
    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.

  12. #12
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 11 Access 2021
    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

  13. #13
    NJTrucker is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    6
    Quote Originally Posted by June7 View Post
    Did you see posts 7 and 9? Checkbox need not be dependent on combobox.
    Until there is a value in TerminationDate, checkbox should be True.
    Really don't need "Terminated" value for Region. This is actually redundant because of TerminationDate field. Could leave with the last assigned region or Null. Code could change Region value when a TerminationDate is entered, even to set field to "Terminated". Not reliant on user to select "Terminated" in combobox.

    I'm kind of new to Access and don't understand some what was posted.

    But i think i would need the option 5 terminated as that is how i show the termination date field or the Hire date field

  14. #14
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    What you show has nothing to do with that checkbox being set or not.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    "Terminated" value for Region field is not necessary for setting Visibility of other controls but I agree it does simplify code and is user-friendly.

    And yes, I was on wrong track about using code behind TransactionDate to set value of Region. Making TransactionDate available is dependent on value in combobox. User HAS to make an explicit decision.

    However, the code I showed is simplest and would work with your current setup.
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 04-16-2020, 10:25 AM
  2. Replies: 5
    Last Post: 09-14-2018, 06:08 AM
  3. Replies: 3
    Last Post: 10-24-2012, 05:41 PM
  4. Where Can I Get Info On Modules
    By aamer in forum Access
    Replies: 1
    Last Post: 08-24-2012, 11:33 PM
  5. Replies: 3
    Last Post: 01-31-2011, 11:47 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