Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-06-2018, 12:50 AM   #1
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Post URGENT HELP , Filter report with two criteria with Macro

Hello Guys ,

i have the attached DB , ( FORM & Report ) i already have a split form and combo list which i already filtered by staff ID ( Macro is attached ) . now i wanna to apply another filter in report ( another filter with Final amount value , ) i mean when i type staff ID in combo list in form then i goto print report , i wanna report to show the mentioned staff ID with final amount only , not all records for this id . so is there any macro i can add it to apply another filter ? Macro.jpg

Report.jpg

Form.jpg

THX GUYS

Ossama22 is offline   Reply With Quote
Old 09-06-2018, 01:03 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,367
Thanks: 0
Thanked 742 Times in 727 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: URGENT HELP , Filter report with two criteria with Macro

instead of using macro, use vb.
in the button to open the report, filter the report here:

Code:
'----------------
sub btnReport_click()
'----------------
dim sWhere as string 

sWhere = "1=1"
if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"

docmd.OpenReport "rMyReport",acViewPreview ,,sWhere
end sub
Ranman256 is offline   Reply With Quote
Old 09-06-2018, 01:07 AM   #3
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Re: URGENT HELP , Filter report with two criteria with Macro

Quote:
Originally Posted by Ranman256 View Post
instead of using macro, use vb.
in the button to open the report, filter the report here:

Code:
'----------------
sub btnReport_click()
'----------------
dim sWhere as string 

sWhere = "1=1"
if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"

docmd.OpenReport "rMyReport",acViewPreview ,,sWhere
end sub
Excuse my little knowledge . is that filter for the staff ID and the final amount ?
and should i replace State , City & Zip Code with STAFF ID & Final amount from my data ?

Ossama22 is offline   Reply With Quote
Old 09-06-2018, 07:18 AM   #4
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,263
Thanks: 13
Thanked 4,110 Times in 4,042 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: URGENT HELP , Filter report with two criteria with Macro

The code given was generic, you'd need to modify with your field/control names.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 09-06-2018, 08:26 AM   #5
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: URGENT HELP , Filter report with two criteria with Macro

ossama22:

you aleays asks questions, but never reply if your previous post have been resolved.

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Reply

Tags
filter , report

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Multiselect to filter report criteria. gilnutz Reports 8 05-21-2013 11:17 AM
Displaying report filter criteria on report header ekta Reports 5 01-28-2013 08:04 AM
How to write SQL macro to filter all the forms and report? latestgood Macros 1 07-01-2011 03:09 PM
Filter a report from criteria on in report header spikepl Reports 15 02-15-2011 08:43 AM
Printing your filter criteria in the report cortevil Reports 2 07-17-2006 04:40 AM




All times are GMT -8. The time now is 11:13 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