Clear filter on report close (1 Viewer)

psyc0tic1

Access Moron
Local time
Today, 13:30
Joined
Jul 10, 2017
Messages
360
I have a form for generating reports base on 2 comboboxes. Randomly I am finding a filter set in the filter property of random reports which screws up what displays.

This doesn't happen to all reports... it is random but the filter that I find in the property is always the same Facility='Ripley'

The code for the form is
Code:
Option Compare Database
Option Explicit

Private Sub cmdGenerateReport_Click()

    If Me.cboReports & "" <> "" Then
        DoCmd.OpenReport cboReports, acViewReport, , IIf(IsNull(Me.cboFacility), "", "Facility='" & Me.cboFacility & "'")
    Else
     MsgBox ("You Must First Select a Report To Print!")
     cboReports.SetFocus
   End If

   cboReports = ""
End Sub

I try and try to make it show up in the property by setting the facility in the first combobox and then choosing the reports I found it set in the property but when I use the comboboxes it is never there. This is like the third time I have had to clear that same filter from 5 or 6 reports.

All reports are set to filter on load = No

I do have a field on the forms this is happening to that displays the facility name chosen from the first combobox on the form in the header of the reports but if I choose that facility that keeps showing up on the property I cannot get it to do it.

Anyone have some insight on how this might be happening or if there is some code I could put in a module for each report to clear that property on report close??
 

psyc0tic1

Access Moron
Local time
Today, 13:30
Joined
Jul 10, 2017
Messages
360
I believe I have discovered the issue.

While sizing the report I realize I was using Ctrl+S on the form in design view to save the physical size of the popup report.... but apparently I did it every time I had tested the generator and chose the Ripley facility... a coincidence I guess. If I generate the report without choosing a facility and then use Ctrl+S on it there is no saved filter.

DUH :banghead:
 

psyc0tic1

Access Moron
Local time
Today, 13:30
Joined
Jul 10, 2017
Messages
360
I got an email saying that someone posted a reply in this thread asking for more clarification because they didn't understand... but I do not see any reply

Maybe the poster deleted it?
 

Users who are viewing this thread

Top Bottom