Hi All!
I've been using access for a few years now and consider myself a pretty advanced user, but for some reason this question has stumped me. I've been trying to use a single report with different queries/filters/sorts and occasionally a filter or sort will "stick" to the report, so when I try to open it again it will give me the message box asking what a particular field is. I've tried to remove the filter/sort in the on_close event, but that doesn't seem to always work either. The worst part is it's seemingly random as to when it decides to give me this error; I can't figure out what's causing it. I'll post my code below, let me know if you have any suggestions.
Code:
'This is the typical open report statement I use with this report. Of course each uses different recordsources, filters and sorts.
DoCmd.OpenReport "CI_Report", acViewReport
Reports!CI_Report.Report.recordSource = IIf(getSTROpSelectQ = 1, "STR_CI_Open", "STR_CI_Max") 'Function to figure out which query to use
Reports!CI_Report.Report.Filter = getSTRFilter 'Function to get the filter
Reports!CI_Report.Report.orderby = getSTRSort 'Function to get the sort
Reports!CI_Report.Report.OrderByOn = True
Reports!CI_Report.Report.filterOn = True
Code:
'The onClose event for the report. I set the filter and orderby properties to empty strings
'then set the recordSource as a default query.
Private Sub Report_Close()Me.Filter = ""
Me.filterOn = False
Me.orderby = ""
Me.OrderByOn = False
Me.recordSource = "CI_q4"
End Sub