combining queries

Delius

New member
Local time
Today, 23:11
Joined
Sep 24, 2004
Messages
5
A database I'm using has 2 main tables I need to work into a query: one for Product Information and one for Discounts applicable to the product's normal price.

There are two types of Discount, and for each I have set up a Query to calculate the final price of the product. The procedure I now need to put together will operate as follows:

1) User enters ItemCode (part number) plus some other optional parameters.
2) ItemCode is checked against the Discounts table, and if it is mentioned specifically in that table, Query1 is run and the process ends. If not, we proceed to Step 3.
3) Each ItemCode has 4 attributes - PM,PS,PF,PL - and each of these must be checked in that order; once one of the attributes matches an entry in the Discounts table, Query 2 is run against the original ItemCode using the corresponding discount attribute and the process ends. If none of the attributes matches, the process should end and the user made aware that no match was found.

Where I'm specifically having problems is in the optional part (whether to run Query 1 or Query 2) and in the correctly ordered repetition of the same query against several attributes, with the process terminating once a result has been found. Can anyone help?

(Sorry if any of the above is unclear... I'm not well practised at trying to describe these things!)
 
Delius,

SQL logic does not like to terminate prematurely. Also, checking for the
(PM,PS,PF,PL) attributes seems iterative, again not what SQL likes.

If you don't find a SQL solution, we can probably write a small VBA
function.

Will wait in the wings and see what the SQL crowd comes up with.

Wayne
 

Users who are viewing this thread

Back
Top Bottom