Hi Jim,
First, I'm glad to hear that the concatenation idea worked for you.
How many possible batch numbers are you talking about? If it's not over a
couple hundred or so, you can add a combo box to your form that displays
the
batch numbers. This would allow you to pick a single batch number to run a
report. (If you want multi-select capability for >1 batch number, then
you'll
need to use a list box with VBA code to build the WHERE portion of a SQL
statement 'on-the-fly'.
With a combo box, you would replace your existing [?] parameter in the
query
with a criteria that grabs it's value from the item that is selected in
the
combo box. If you have a separate table of batch numbers, then I'd base
the
row source for the combo box on this table. Something like this (pkBatchNo
is
the primary key field--use the appropriate names for fields in your case):
SELECT pkBatchNo FROM tblBatches
or perhaps this:
SELECT pkBatchNo, BatchDesc FROM tblBatches ORDER BY BatchDesc
The first form would require a column count of 1, whereas the second form
would need a column count of 2. The bound column could be column 1 in both
cases.
In the query, you would add a criteria to the pkBatchNo field that looks
like this:
=[Forms]![NameOfForm]![NameOfComboBox]
You'll probably want to add some code to ensure that the user has selected
a
value in the combo box when they click on an OK button to open the report.
If
you include a NoData event procedure in the report, to inform the user
with a
message box that there are no records, and to cancel opening the report,
then
you'll want to trap for error 2501 in the click event procedure for the
command button on the form.
If you send me a private e-mail message with a valid reply-to address, I
will send you a sample. My e-mail address is shown on the bottom of the
contributors page indicated my sig. block. Whatever you do, please do not
post your real e-mail address (or mine) to a newsgroup message. Doing so
will
only invite the unwanted attention of spammers.
Tom
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
:
Hi Tom,
That makes sense. I tried it and it does just what you said!
If I may I am using a command button in a form to bring up the report
in
question. In the query that the report is based on I have a [?] in the
criteria area to prompt me for the right batch of names. When the report
starts a dialog box pops up asking me to Enter Parameter Value. Above the
entry point is the ?. Can that be changed to say "Enter Batch No."? Or
better yet can I pass the current reports batch No. to the query when I
press the command button? I have some VB experience if that helps.
Thank You
Jim Mac Millan