filter report

Ravi Kumar

Registered User.
Local time
Today, 05:21
Joined
Aug 22, 2019
Messages
162
dear all,
I have a combo box in a form to filter the report filed,
my requirement is to only filter the report, but it shouldn't open it,
because that work will be done after clicking another button where date will be filtered.
but unfortunately this is not working. Anyone pls help me.
Code:
Private Sub cmdFilter_Click()
Dim StrWhere As String
Dim strreport As String
strreport = "OT details"
StrWhere = "[Area]" = Me.cbolocationbrief & "'"
End Sub
 
Can't change filter of a report open in PrintPreview.

So if report is in ReportView:

Reports![OT Details].Filter = "[Area]" = Me.cbolocationbrief & "'"
Reports![OT Details].FilterOn = True
 
Ravi


If Area is a text field, there is a missing quote there.


Code:
... "[Area]='" & Me.cbolocationbrief & "'"
 
Ravi


If Area is a text field, there is a missing quote there.


Code:
... "[Area]='" & Me.cbolocationbrief & "'"

hello sir ,
should I do this using expression builder to the filed in my report , because in vba after button click it is not working.
 
now it is giving error 2451,
I don't want to open my report after clicking this button (if this sentence helps you).
 
Code goes behind button on form or combobox AfterUpdate event.

What is the message of error 2451?
 
Code goes behind button on form or combobox AfterUpdate event.

What is the message of error 2451?

It is saying I am trying to run the code for the report which is not open.
 
That is a clear message.

Report must be open.
 

Users who are viewing this thread

Back
Top Bottom