423,688 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,688 IT Pros & Developers. It's quick & easy.

Sending Criteria to a Report

P: 38
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.
Regards
Irshad Ahmed
1 Week Ago #1
Share this Question
Share on Google+
7 Replies


twinnyfo
Expert Mod 2.5K+
P: 2,667
Irshad,

I moved your post to a new thread, as it truly is a new topic.
1 Week Ago #2

twinnyfo
Expert Mod 2.5K+
P: 2,667
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!
1 Week Ago #3

NeoPa
Expert Mod 15k+
P: 31,084
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.
1 Week Ago #4

twinnyfo
Expert Mod 2.5K+
P: 2,667
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!

:-)
1 Week Ago #5

NeoPa
Expert Mod 15k+
P: 31,084
Hey. It's easier than doing all the work you guys do still ;-)
1 Week Ago #6

P: 38
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.

Thanks
Irshad Ahmed
1 Week Ago #7

twinnyfo
Expert Mod 2.5K+
P: 2,667
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.
1 Week Ago #8

Post your reply

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