473,398 Members | 2,212 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,398 software developers and data experts.

Using multiple optional criteria.

I have a search form that has two combo boxes, each with a list of possible criteria to search for. For this example lets say I'm tracking purchases of one of three items in one of three states. I want my end user to be able to search for all purchases of item #1 in state #1 but also all purchases of item #1 in all states and all purchases of all items in state #1. Is there a way to design my query in such a way that leaving one of the boxes blank, or selecting "all" in that box, would allow the query to run with just the criteria from the other box?
Aug 5 '15 #1
2 2020
Seth Schrock
2,965 Expert 2GB
There may be an easier way via SQL, but I use VBA to build a filter string based on the used search boxes.
Aug 5 '15 #2
jforbes
1,107 Expert 1GB
When using a Command Button or similar Form Event to create a Filter or the full SQL Select, I would agree with Seth, using VBA is the way to go as it is much more flexible. This is a pretty decent way to go about it: http://bytes.com/topic/access/insigh...filtering-form

Another option that appeals to some people is to create the Query in the Query Editor with the Where clause including references to TextBoxes or ComboBoxes on a Form. I'm not recommending this, but some people like it. This may not be the best Example, but it is dealing with Null values for a saved Query Definition: http://bytes.com/topic/access/answer...es#post3792346
Aug 6 '15 #3

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

Similar topics

4
by: steve | last post by:
I'm new to XML, so pardon the stupid question. I've looked thru several books with not luck. All I want to do is associate one xml file with multiple xsl stylesheets. For example, if the user...
4
by: pcerio | last post by:
Hello All, Is it possible to have two different queries using parameters on the same report? Thanks. Trish
5
by: | last post by:
Hi all, HttpWebRequest, and SoapHttpClientProtocol both expose a ClientCertificates property, which can hold multiple client certificates, but on the service side, it can only receive one client...
0
by: dtrudell75 | last post by:
Hi there, I'm running Visual Basic .Net 2003 and developing a windows mobile 2003 application. I'm using the following code to create and dispose of forms, but I'm running into a Stack...
1
by: Casey | last post by:
Hi, How would one allow for possible multiple search criteria using FREETEXTTABLE. For example, my table "listings" has a full-text search catalog, and I may want to: SELECT * FROM listings...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
10
by: FNA access | last post by:
Hello to the world of the wise, I am a CSOM student at TRU. I am trying to design a database to improve my understanding. The problem I am having is with setting up a query. I have a Query...
3
by: Matt | last post by:
Hey guys. I'm currently working through a number of C programming exercises to get me up to speed with the syntax. Before now I have been using Fortran and I've found Plato3 in Windows to be an...
2
by: dlevene | last post by:
Hi - newbie here, be gentle. In Access 2003, I've created a report (based on a query) to produce mailing labels for all records where = "Community". is a combo-box field with the values coming from...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.