Results 1 to 4 of 4
  1. #1
    whisp0214 is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    May 2017
    Posts
    30

    Filtering Report Issue

    I have a main form that filters a subform and I have a button that creates a report from the filtered data. All works great except for when I clear the filters. The subform clears and shows that it is unfiltered, but when i click the button to create the report, it only shows the data from when it was last filtered. This leads me to believe the Clear button works, and it is an issue with the Report button. The code is below. Any suggestions, would be appreciated.

    Code:
    Private Sub cmdClear_Click()
    
    
        Me!cbosalesperson = Null
        Me!cboVendor = Null
        Me!cboRetailer = Null
        Me!cboPaid = Null
    
    
    On Error GoTo cmdclear_click_err
    
    
        Me.PurchaseOrderssub.Form.FilterOn = False
        
    cmdclear_click_exit:
        Exit Sub
    
    
    cmdclear_click_err:
        MsgBox Error$
        Resume cmdclear_click_exit
    
    
    End Sub
    
    
    
    
    Private Sub cmdReport_Click()
     On Error GoTo cmdReport_Click_Err
     
     Dim strfilter As String
     strfilter = Me.PurchaseOrderssub.Form.[Filter]
     
     If strfilter <> "" Then
        DoCmd.OpenReport "rptPurchaseOrders", acViewPreview, , strfilter
        DoCmd.SendObject acReport, "rptPurchaseOrders", acFormatXLS, "", "", "", "", "", True, ""
     
     Else
        DoCmd.OpenReport "rptPurchaseOrders", acViewPreview
        
    cmdReport_Click_Exit:
        Exit Sub
    
    
    cmdReport_Click_Err:
        MsgBox Error$
        Resume cmdReport_Click_Exit
    End If
    
    
    End Sub


  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Set the filter to "" in addition to setting FilterOn to False.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    whisp0214 is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    May 2017
    Posts
    30
    Very Simple. Much appreciated.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Report filtering issue
    By Mick99 in forum Access
    Replies: 2
    Last Post: 08-20-2015, 10:13 PM
  2. Issue with searching and filtering query
    By federer8 in forum Queries
    Replies: 1
    Last Post: 02-08-2013, 06:21 PM
  3. Issue with filtering results on a form
    By Aaron5714 in forum Access
    Replies: 5
    Last Post: 05-31-2012, 07:03 AM
  4. Replies: 7
    Last Post: 04-03-2012, 12:29 PM
  5. Filtering my report
    By ldarley in forum Reports
    Replies: 1
    Last Post: 09-05-2008, 09:14 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