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!)
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!)