URGENT HELP , Filter report with two criteria with Macro (1 Viewer)

Ossama22

Registered User.
Local time
Today, 22:35
Joined
Aug 31, 2018
Messages
52
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
 

Ranman256

Well-known member
Local time
Today, 16:35
Joined
Apr 9, 2015
Messages
4,339
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
 

Ossama22

Registered User.
Local time
Today, 22:35
Joined
Aug 31, 2018
Messages
52
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 ?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:35
Joined
Aug 30, 2003
Messages
36,118
The code given was generic, you'd need to modify with your field/control names.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:35
Joined
May 7, 2009
Messages
19,169
ossama22:

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

Users who are viewing this thread

Top Bottom