Results 1 to 4 of 4
  1. #1
    mlrucci is offline Competent Performer
    Windows 7 64bit Office 365
    Join Date
    Apr 2018
    Posts
    202

    Set Triple State Toggle button values

    I am attempting to create a triple set toggle button to allow the end user to visualize data based on criteria. I would like them to have the ability to visualize
    1. All records
    2 Required Records
    3. Not Required Records

    but using the toggle button. I have created the toggle button and the toggle buttons by default are set to Null, True, and False. I am trying to reset the original default value to all. Ideas?

    I also changed to color and captions below and should read something like this: Just stuck on how to get all and not null.



    Code:
    Private Sub TogRequired_Click()    If IsNull(Me.togRequired.Value) Then
           ' Me.togRequired.value =
            Me.togRequired.Caption = "All"
            Me.togRequired.BackColor = 16
        ElseIf togRequired.Value = True Then
            Me.togRequired.Caption = "Yes"
            Me.togRequired.BackColor = 10
        ElseIf Me.togRequired.Value = False Then
            Me.togRequired.Caption = "No"
            Me.togRequired.BackColor = 0
        End If
    End Sub
    Any help would be appreciated.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe explain more about what you want, not so much what you have done?
    Clicking on a toggle button will change the value to True/False (-1 or 0). you cannot set the toggle button to NULL without using a different control.


    If you want the option to have one control for
    1. All records
    2 Required Records
    3. Not Required Records

    I would use an option group with 3 radio buttons/check boxes/toggle buttons. Then, in the click event of the option group, set the back color, caption, filter the records......
    It would also help if you would post your dB with info on the form, control, etc..

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Toggle buttons are only true/false - don't confuse them with option buttons. ssanfu's suggestion to use option controls bound to a frame might be best. Second might be a combo box. The latter case would allow you to add options without having to re-design the form beyond altering any code.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    mlrucci is offline Competent Performer
    Windows 7 64bit Office 365
    Join Date
    Apr 2018
    Posts
    202
    I figured it out. in the qry there is a field Required with criteria of (true/false) I placed [Forms]![frmSCPage]![togRequired] or [Forms]![frmSCPage]![togRequired] is null. This allows the button to read Is Null, true, false. This resluts in:

    Code:
    SELECT tblPages.PageID, lnkPageToMCFieldName.RequiredFROM tblPages INNER JOIN lnkPageToMCFieldName ON tblPages.PageID = lnkPageToMCFieldName.PageID
    WHERE (((tblPages.PageID)=[Forms]![frmSCPage]![cboPageID]) AND ((lnkPageToMCFieldName.Required)=[Forms]![frmSCPage]![togRequired])) OR (((lnkPageToMCFieldName.Required)=[Forms]![frmSCPage]![togRequired]) AND (([Forms]![frmSCPage]![cboPageID]) Is Null)) OR (((tblPages.PageID)=[Forms]![frmSCPage]![cboPageID]) AND (([Forms]![frmSCPage]![togRequired]) Is Null)) OR ((([Forms]![frmSCPage]![cboPageID]) Is Null) AND (([Forms]![frmSCPage]![togRequired]) Is Null));
    When I went back and was stripping down the db to submit for assistance, I realized what I needed to do. Thanks for the help!!

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

Similar Threads

  1. Toggle Button Help
    By dhas in forum Access
    Replies: 2
    Last Post: 09-17-2018, 11:06 AM
  2. Button to Toggle Image On/Off
    By Tycho4511 in forum Access
    Replies: 2
    Last Post: 07-06-2018, 09:20 AM
  3. Toggle Button
    By gheyman in forum Access
    Replies: 2
    Last Post: 07-11-2017, 07:43 AM
  4. Toggle Button Help
    By dbalilti in forum Access
    Replies: 1
    Last Post: 07-05-2012, 04:23 AM
  5. Triple State checkbox scroll order
    By lfox in forum Forms
    Replies: 7
    Last Post: 06-26-2010, 08:19 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