Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2017
    Posts
    16
    Provided Answers: 1

    Unanswered: Advanced report filtering?

    I have a field named RG which is used to filter details on a report. The particular report which I am trying to get refers to two different RG. One of those RG is for the main data and the other RG is for a subset of that data. I'm not entirely sure why this was done, but I'm trying to create a work-around for it so that when one is called the other also displays. Does anybody know of a way that I can open a report where both of this data can be displayed? Thanks for any help.

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    614
    Provided Answers: 32
    you may need 2 reports,(easiest)
    1 for RG main data
    1 for RG subset

  3. #3
    Join Date
    Jun 2017
    Posts
    16
    Provided Answers: 1
    Quote Originally Posted by ranman256 View Post
    you may need 2 reports,(easiest)
    1 for RG main data
    1 for RG subset
    The problem with this is that the ordering of records is specific by another field, CL, which has a specific LineNum so that the ordering of the report is correct. If I created a new report I could only put it in the header/footer of the other report... right? I had minor success with this:
    Code:
    If Reports![Program Document]!RG = 3162 Then
                            MsgBox "Success in determining RG 3162 OR 3596"
                            DoCmd.OpenReport "Program Document", acViewReport, , "RGDescription LIKE 'Mechanical Engineering*' AND DegreeType LIKE '*ME'" & _
                        " OR SubPlanID = '" & cmbPlanSub & "'"
                            ElseIf Reports![Program Document]!RG = 3596 Then
                            'get both of these RG to appear in the same program document
                            'DoCmd.OpenReport "Program Document", acViewReport, , "RG =" & cmbCriteria & "and " & lookup & " AND SubPlanID = '" & _
                        cmbPlanSub & "'"
                        'DoCmd.OpenReport "Program Document", acViewReport, , "RG =" & 3162 & "OR RG=" & 3596 & " AND SubPlanID = '" & _
                        cmbPlanSub & "'"
                        DoCmd.OpenReport "Program Document", acViewReport, , "RGDescription LIKE 'Mechanical Engineering*' AND DegreeType LIKE '*ME'" & _
                        " OR SubPlanID = '" & cmbPlanSub & "'"
                        [Reports]![Program Document]![Archive Search Report].Visible = False
                            Else
                            Debug.Print "This is not RG 3162 or RG 3596"
                            End If
    cmbCriteria is a combobox on my form. Lookup is a DLookup for RG (the numbers are essentially the same). Doesn't work without both for whatever reason.

    I've also considered dipping more into OOP VBA. I'm not very experienced with OOP, especially in VBA, and it would be quite annoying to redo everything I've done with classes instead. I'll probably have to go and do that at some point regardless, though.
    Last edited by award73; 09-19-17 at 09:08.

Posting Permissions

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