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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering multiple parameters

Status
Not open for further replies.

cmcdonald

Technical User
Aug 2, 2000
11
EU
I have a query which prompts for an order no. each time it is run. However, I need it to return values for more than one parameter.

I thought that I could enter , eg, '1524 or 1511' in the pop up box, but this returns an error message. I get the same message when I use commas to separate the values.

Any suggestions?

Cara [sig][/sig]
 
Lets get a little more detail.. Do you need the query to return more than one record with different order numbers or do you need one order number and some other parameter?

Another question, will there always be the same number of parameters each time the query is run?

John
[sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
I'm not sure how much more detail I can provide, so I will try and make the question clearer.

I have:
[Enter Order Number]

as the parameter.
If the user enters one number, they will get the record(s) corresponding to that number.

I want them to be able to enter more than one number at a time without a limit to the number of parameters. It could be different each time.

Hope this is clearer. [sig][/sig]
 
I would use a looping routine to ask the user for additional entries to look for, test each value entered for proper structure (no letters if you need numbers),then count the number of things to look for, this would become the WHERE part of the query,(field = 1234) OR (field = 1235) OR (field = 1236)...... run the query, count the records, compare to the first number to see if all the records were found, generate a message about the results if necessary, and so on.... Because the query could return less than the requested number of records, you might need to have some type of logic regarding what to do in that situation. Let me know if you need help with this type of programming.

John [sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
Help! Sounds much more complex than I'd anticipated, and possibly than I need. The query runs fine if I enter multiple criteria as part of the design. I thought there might be a simple solution to the parameter prompt problem.

Lets try the first part of your suggestion?

Cara [sig][/sig]
 
Dont worry be happy! With a website like this you will get on the fast track ;-)

If your query needs to be able to run sometimes with only one order number and sometimes with more than one, then hard coding say three choices would not work very well.

There are a few ways to do this. How many choices do you want your users to have regarding the number of orders to look for?

John [sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
Post the sql view of your existing query and I will post the loop for getting the user to enter additional order numbers. It's not as tough as you think.
[sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
Here you go:

SELECT POrder.POrder_RaisedDate, POrder.POrder_No, Cust.Cust_Ref, Products.Product_Code
FROM (Products INNER JOIN (Trans INNER JOIN (SOrder INNER JOIN Cust ON SOrder.SOrder_CustID = Cust.Cust_ID) ON Trans.Trans_SOrderID = SOrder.SOrder_ID) ON Products.Product_ID = Trans.Trans_ProductID) INNER JOIN POrder ON Trans.Trans_Batch = POrder.POrder_Batch
WHERE (((POrder.POrder_No)=[Enter Purchase Order Number]));

Your help is much appreciated!

Cara [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top