I
I'm a Trampoline
A report of mine is experiencing very erratic behavior. If I filter the
report, I can set an unbound field on it afterwards (it's marked in the
code sample below) but if I don't filter the report (I set the FilterOn
property to False in case the report is already on screen and filtered),
this field turns out empty. I have no idea why, my 'FilterTextString'
exists under both circumstances, whether there's a filter for the report
of not. I can confirm this because I can set that field to "Bananas" and
it behaves the same way, it works when filtered, and doesn't when not
filtered.
Thanks in advance.
Note: the use of the recordset is only for giving the user an error if
there's no records.
Function ShowAndFilterReport()
If CombinedFilterString <> "" Then
Set rs = CurrentDb().OpenRecordset("SELECT * FROM
UnitsAndIssuesQuery WHERE " & CombinedFilterString)
Else
Set rs = CurrentDb().OpenRecordset("SELECT * FROM
UnitsAndIssuesQuery")
End If
If rs.BOF Then
MsgBox "No records were found.", , "Report Query"
Else
DoCmd.OpenReport "IssuesReport", acPreview
If CombinedFilterString <> "" Then
Reports!IssuesReport.Filter = CombinedFilterString
Reports!IssuesReport.FilterOn = True
Else
Reports!IssuesReport.FilterOn = False
End If
'******* The text box in question below *******
'(Even if this is set to "Bananas" it still doesn't work.
Reports!IssuesReport.FilterText.Value = FilterTextString
End If
rs.Close
End Function
report, I can set an unbound field on it afterwards (it's marked in the
code sample below) but if I don't filter the report (I set the FilterOn
property to False in case the report is already on screen and filtered),
this field turns out empty. I have no idea why, my 'FilterTextString'
exists under both circumstances, whether there's a filter for the report
of not. I can confirm this because I can set that field to "Bananas" and
it behaves the same way, it works when filtered, and doesn't when not
filtered.
Thanks in advance.
Note: the use of the recordset is only for giving the user an error if
there's no records.
Function ShowAndFilterReport()
If CombinedFilterString <> "" Then
Set rs = CurrentDb().OpenRecordset("SELECT * FROM
UnitsAndIssuesQuery WHERE " & CombinedFilterString)
Else
Set rs = CurrentDb().OpenRecordset("SELECT * FROM
UnitsAndIssuesQuery")
End If
If rs.BOF Then
MsgBox "No records were found.", , "Report Query"
Else
DoCmd.OpenReport "IssuesReport", acPreview
If CombinedFilterString <> "" Then
Reports!IssuesReport.Filter = CombinedFilterString
Reports!IssuesReport.FilterOn = True
Else
Reports!IssuesReport.FilterOn = False
End If
'******* The text box in question below *******
'(Even if this is set to "Bananas" it still doesn't work.
Reports!IssuesReport.FilterText.Value = FilterTextString
End If
rs.Close
End Function