473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Conditional Where clause using SQL in Access

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
1 1604
Rabbit
12,516 Expert Mod 8TB
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

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

Similar topics

3
by: JED | last post by:
I have an opportunity to work on a web based project using Access. However, there has been a suggestion that MySQL might be a better alternative. The project is actually a small project (less than...
5
by: dananrg | last post by:
I've created a small company database where the tables reside in a SQL Server database. I'm using Access 2000 forms for a front end. I've got a System DSN set-up to SQL Server and am using links...
4
by: Barry Edmund Wright | last post by:
I would really appreciate your assistance. I am using Access 2000 to create a form that Lists Names and Addresses based on a number of selection criteria one of which is a combo box cboPCZip. All...
3
by: bill mahoney | last post by:
Hello, I am using access 2000 and I am trying to email a csv file. I have only used the docmd.sendobject command but you can only email objects that are within the access database ( as far as I...
3
by: ARZ | last post by:
Hi How do I include DLLs based on a condition. Eg., there are 2 DLLs 'Oracle.dll' and 'SQL.dll'. I need to include ANYONE of the DLLs based on a value. Is it possile in C# Thanks in advance ARZ
4
by: Bugs | last post by:
Hi everyone. I am trying to open a database which works fine using Access 2003, but when trying to open it on another PC that has Access 2002 I get the following error "This database is...
15
by: Peter Liu | last post by:
someting like return (a==b)?a:((b==c)?:..)................ thanks
6
by: GAC | last post by:
I've used conditional formatting on ACCESS reports but have come up with a problem using it for a FIELD that has a value of either YES or blank/null. The default formatting (used when condition(s)...
2
by: icenemesis | last post by:
I am using Access 2000 and have this setup. Tables Program Procedure WorkInstruction Form the tables are set up with the following relationships.
3
by: Bruce | last post by:
I have a number of Access 2000 format databases on a Windows 2003 server. For some reason I can no longer compact these databases directly on the server using Access 2003. Access 2000 seems to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.