By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

Conditional Where clause using SQL in Access

P: 12
Hi all,

Here is my situation. I've got 3 combo boxes that are used to filter data from my main database. These are Organisation Name, Contract Type and Branch Name.

Under normal circumstances that's easy to do, however there is another constraint. There are 3 contract types, 1 of them (Type A) requires all 3 fields to be populated and searched upon. However if it's any of the other 2 (Type B and C) then it must search based on just Organisation Name and Contract Type. The way I've thought of doing this is using some kind of conditional where clause but I'm not sure how to go about writing the script.

I thought about a case clause but I don't think it's supposed to used in that way.

I know I'm supposed to put some kind of attempt at the code but none of the coding I've used so far even comes close to making sense.

Any help you lovely people can offer will be great

Thanks

Sunny
Jun 14 '12 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,359
Filter the name and type normally. For branch, use the IIf() function to check the contract type, if it's type A, return the value to filter on, otherwise return the branch.
Jun 14 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.