Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    63

    Unanswered: Filtering a Report's Subform On Load

    Hi there,

    I have a report with a subform that needs to be filtered. The main form is already filtered when it's opened but I also need another subform to be filtered. I have an OnLoad event that doesn't run into any errors but it doesn't filter the subform...I don't know why it's doing that.


    This is the OpenReport command. It filters the report by Audit_ID.
    Code:
    Private Sub btnPreviewReport_Click()
    Dim Audit_ID As Long
    Audit_ID = Me!subfrmCreateReportNotes.Form!Audit_ID
    DoCmd.OpenReport "rpt", acViewReport, , "Audit_ID = " & Audit_ID
    End Sub
    A subform of the report also needs to be filtered by the Audit_ID. This is the OnLoad event.
    Code:
    Private Sub Report_Load()
    Dim Audit_ID As Long
    Audit_ID = Me.Audit_ID
    Me.subfrmCreateReportCPARs.Form.Filter = "[Audit_ID] = " & Audit_ID & ""
    Me.subfrmCreateReportCPARs.Form.FilterOn = True
    End Sub
    Any help will be greatly appreciated!

  2. #2
    Join Date
    Jul 2011
    Posts
    63
    Never mind, I put the filter on the subform's OnLoad event and seems to be working now

  3. #3
    Join Date
    Jul 2011
    Posts
    63
    Does anyone know why my filter doesn't work in the Print Preview? Is there a work-around for this?

Posting Permissions

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