Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-24-2019, 01:58 AM   #1
Ravi Kumar
Newly Registered User
 
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
Ravi Kumar is on a distinguished road
filter report

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

Ravi Kumar is offline   Reply With Quote
Old 09-24-2019, 02:05 AM   #2
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,425
Thanks: 0
Thanked 568 Times in 564 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: filter report

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
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
Ravi Kumar (09-24-2019)
Old 09-24-2019, 02:13 AM   #3
Cronk
Newly Registered User
 
Join Date: Jul 2013
Posts: 2,152
Thanks: 3
Thanked 470 Times in 463 Posts
Cronk will become famous soon enough Cronk will become famous soon enough
Re: filter report

Ravi


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


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

Cronk is offline   Reply With Quote
The Following User Says Thank You to Cronk For This Useful Post:
Ravi Kumar (09-24-2019)
Old 09-24-2019, 02:14 AM   #4
Ravi Kumar
Newly Registered User
 
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
Ravi Kumar is on a distinguished road
Re: filter report

dear june7,
where to apply this ??
Ravi Kumar is offline   Reply With Quote
Old 09-24-2019, 02:28 AM   #5
Ravi Kumar
Newly Registered User
 
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
Ravi Kumar is on a distinguished road
Re: filter report

Quote:
Originally Posted by Cronk View Post
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 is offline   Reply With Quote
Old 09-24-2019, 02:36 AM   #6
Ravi Kumar
Newly Registered User
 
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
Ravi Kumar is on a distinguished road
Re: filter report

now it is giving error 2451,
I don't want to open my report after clicking this button (if this sentence helps you).
Ravi Kumar is offline   Reply With Quote
Old 09-24-2019, 03:12 AM   #7
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,425
Thanks: 0
Thanked 568 Times in 564 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: filter report

Code goes behind button on form or combobox AfterUpdate event.

What is the message of error 2451?

__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
Ravi Kumar (09-24-2019)
Old 09-24-2019, 03:42 AM   #8
Ravi Kumar
Newly Registered User
 
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
Ravi Kumar is on a distinguished road
Re: filter report

Quote:
Originally Posted by June7 View Post
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.
Ravi Kumar is offline   Reply With Quote
Old 09-24-2019, 11:28 AM   #9
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,425
Thanks: 0
Thanked 568 Times in 564 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: filter report

That is a clear message.

Report must be open.

__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
Ravi Kumar (09-24-2019)
Reply

Tags
beginner , report , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter Report Base On form query/filter with LIKE * bignose2 Queries 1 02-22-2018 02:08 AM
filter by form, report filter Lifeseeker Forms 1 03-28-2011 03:23 PM
filter in report based on table's filter JuniorWoodchuck24 Reports 5 05-12-2010 07:24 AM
Loading a Filter with a report Using the Form's Filter Property Line Item catbeasy Reports 2 07-08-2009 07:41 AM
Filter A Report USING a Forms Filter Results ZinksInk Queries 1 10-25-2006 06:40 PM




All times are GMT -8. The time now is 05:12 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World