By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,537 Members | 2,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,537 IT Pros & Developers. It's quick & easy.

Sending Criteria to a Report

P: 71
Hi friends

I changes the Territory Combo Box to List Box.
Multi Select = Extended

Now how to pass this criteria to Report.
Report Query is based by selection of
1 Company
1 Region
1 Territory.
Now how to set is for Multi Select Territory.

All are request for help.
Irshad Ahmed
Nov 8 '18 #1
Share this Question
Share on Google+
7 Replies

Expert Mod 2.5K+
P: 3,284

I moved your post to a new thread, as it truly is a new topic.
Nov 8 '18 #2

Expert Mod 2.5K+
P: 3,284
What you are trying to do is actually built into the call to open a report in Access:

Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.OpenReport(ReportName:="YourReportName", _
  2.                       WhereCondition:="Company = " & Me.cboCompany & _
  3.                              " AND Region = " & Me.cboRegion & _
  4.                              " AND Territory = " & Me.cboTerritory)
Hope this hepps!
Nov 8 '18 #3

Expert Mod 15k+
P: 31,494
Twinny mentions the possibility of passing the criteria in a call to DoCmd.OpenReport. WhereCondition is one of the possible parameters, and probably the most pertinent for your question. However, it doesn't hurt to know that there is also another called OpenArgs. Literally for passing an argument, or multiple ones within a single string if required, to the Report.
Nov 8 '18 #4

Expert Mod 2.5K+
P: 3,284
Hey, NeoPa! Thanks for fixing my named argument! Sometimes I just get typing a forget to check these things.

Thanks for keeping me in line!

Nov 8 '18 #5

Expert Mod 15k+
P: 31,494
Hey. It's easier than doing all the work you guys do still ;-)
Nov 9 '18 #6

P: 71
Hello dears .......... this is my sql for Single Selection of Company, Region, Territory, and Territory List Box is set to Multi Select = None

Expand|Select|Wrap|Line Numbers
  1. SELECT Territory.TerritoryName, Territory.RegionID
  2. FROM Territory
  3. WHERE (((Territory.RegionID)=[Forms]![frmFORM002]![Region_Combo2]))
  4. ORDER BY Territory.TerritoryName;
This is working well and my required Territory Data is at Report preview.

I change In Territory List Box Property
Multi Select = Extend

Now even Single Territory is NOT working and Message
"There is No Data for selected Territory".

Where I am making Mistake.. What is the other way.. Seniors are requested for help.

Irshad Ahmed
Nov 9 '18 #7

Expert Mod 2.5K+
P: 3,284
You have to extract the individual values from a List Box in order to use them.

This Thread (Retrieve Values from a Multi-Select Listbox) may be helpful.

Once you create that string, you can use that value to filter your report:

Expand|Select|Wrap|Line Numbers
  1. "Territory IN (" & strValue & ")"
You would use this in conjunction with Post #3 above and the value generated in the linked thread.

Let us know if you require additional assistance on this one.
Nov 9 '18 #8

Post your reply

Sign in to post your reply or Sign up for a free account.