filter report (1 Viewer)

Ravi Kumar

Registered User.
Local time
Today, 04:50
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
 

June7

AWF VIP
Local time
Yesterday, 15:20
Joined
Mar 9, 2014
Messages
5,465
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
 

Cronk

Registered User.
Local time
Today, 09:20
Joined
Jul 4, 2013
Messages
2,771
Ravi


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


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

Ravi Kumar

Registered User.
Local time
Today, 04:50
Joined
Aug 22, 2019
Messages
162
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.
 

Ravi Kumar

Registered User.
Local time
Today, 04:50
Joined
Aug 22, 2019
Messages
162
now it is giving error 2451,
I don't want to open my report after clicking this button (if this sentence helps you).
 

June7

AWF VIP
Local time
Yesterday, 15:20
Joined
Mar 9, 2014
Messages
5,465
Code goes behind button on form or combobox AfterUpdate event.

What is the message of error 2451?
 

Ravi Kumar

Registered User.
Local time
Today, 04:50
Joined
Aug 22, 2019
Messages
162
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.
 

June7

AWF VIP
Local time
Yesterday, 15:20
Joined
Mar 9, 2014
Messages
5,465
That is a clear message.

Report must be open.
 

Users who are viewing this thread

Top Bottom