Results 1 to 3 of 3

Thread: OptionGroup on Report

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,411
    Location

    OptionGroup on Report

    I have an executive level report based on a query (A) that displays a list of project update briefing due dates. This is all well and good provided the staff properly enters the project update due date in the table record. If the due date is not entered then the project (and its required update briefing) is not included in the report.

    To prevent that, I created a second query (B) that includes both projects with a future due date and project where no due date is defined.

    I wanted the report to open showing results of query B and include a method to toggle the displayed results between query A and B.

    I was able to do that with a button on the report:

    Private Sub cmdToggleView_Click()
        If Me.cmdToggleView.Caption = "Click to Filter List" Then
            Me.cmdToggleView.Caption = "Click to Show Full List"
            Me.RecordSource = "qryA"
            Me.Requery
        Else
            Me.cmdToggleView.Caption = "Click to Filter List"
            Me.RecordSource = "qryB"
            Me.Requery
        End If
        lbl_Exit:
        Exit Sub
    End Sub
    It worked flawlessly.

    Now, I thought a better design would be to have a pair of option buttons where the default value would be the Full List (qryB) and the user could click the "A" option to toggle the

    Private Sub frmToggleView_Click()
        If Me.frmToggleView.Value = 1 Then
            Me.RecordSource = "qryA
            Me.Requery
        Else
            Me.RecordSource = "qryB"
            Me.Requery
        End If
        lbl_Exit:
        Exit Sub
    End Sub
    This method works as well, but the option buttons appear dimmed (neither are displayed as selected or not selected) and they don't change state when clicked.

    What am I doing wrong?

    Thank you.
    Last edited by Aussiebear; 07-04-2024 at 01:08 PM.
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •