Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple crieterias for a Access Report

Status
Not open for further replies.

kastaman

IS-IT--Management
Sep 24, 2001
181
CA
In my report, it prompts the user to key in a request #.
I have done this through a query.

What I'd like to have as a option is the ability to key in more than one request # in the pop-up box.

Is there a simple way to do this so that the user can print multiple requests that are not consecutive in #?

Thanks in advance,

Kastaman.
 
I know of no way to achieve this easily using parameters. You can, however, do this easily and effectively with a multiselect listbox on an unbound form. You must use code to build the necessary SQL Where claus to pass to the DoCmd.OpenReport statement, but this is not too difficult.
 
JerryDenison - Your sugggestion is probably what I'm looking for. Can you instruct on how to create a multiselect list box?

Kastaman
 
You could always use multiple parameters. For example, in the criteria field:

instead of
[Request Number]

try
[Request Number 1] OR [Request Number 2] OR [Request Number 3]

If you don't mind having to hit enter a few extra times if you only want one.. its an easy way to do it. Any field left blank will be ignored. -Dustin
Rom 8:28
 
Use the following syntax for iterating through a multiselect listbox's selected collection appending the selection to a string that will be used as the Where clause of your DoCmd.OpenReport statement:

Dim varItem As Variant
Dim strSQL As String
Set ctl = Me.ListBoxControl' Your control name

For Each varItem In ctl.ItemsSelected
strSQL = strSQL & "[CriteriaFieldName]" & ctl.ItemData(varItem) & " OR "
Next varItem

' Trim the end of strSQL
strSQL=left$(strSQL,len(strSQL)-4))

DoCmd.OpenReport "ReportName",,,strSQL


NOTE: substitute your actual control and field names for the placeholders given.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top