473,387 Members | 1,517 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,387 software developers and data experts.

Select "All" Option

Hi All

I am doing a multiple table and field database search, and my problem
lies in the options that a user has. In each field, the user can specify
a specific value or any value. I take each value from the form and store
them as variables which are passed onto another asp page. I then have an
SQL statement constructed which takes these variables as conditions and
returns matching records. If they choose a specific value for each
field, there is no problem but if they choose "All", I want to be able
to use the same SQL statement as well.

Heres a bit of code that works if strRegion is equal to a value stored
in the table, ie London, Scotland etc.

SELECT DISTINCT tblVenue.Area FROM tblEventType INNER JOIN (tblVenue
INNER JOIN (tblEvent INNER JOIN tblLINKVenue_Event ON
tblEvent.lngEventID = tblLINKVenue_Event.lngEventID) ON
tblVenue.lngVenueID = tblLINKVenue_Event.lngVenueID) ON
tblEventType.lngEventTypeID = tblEvent.lngEventTypeID WHERE
(((tblVenue.Region)='"&strRegion&"'))"

How do i incorporate "All"?. If coice is "All" I was thinking about
making strRegion = London OR Wales OR Scotland OR etc etc etc. Is there
a quicker way of doing this?

Thanks Again


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
1 2373
The quickest way would probably be to concatenate the WHERE clause on.

strSQL = "SELECT DISTINCT tblVenue.Area FROM tblEventType INNER JOIN
(tblVenue
INNER JOIN (tblEvent INNER JOIN tblLINKVenue_Event ON
tblEvent.lngEventID = tblLINKVenue_Event.lngEventID) ON
tblVenue.lngVenueID = tblLINKVenue_Event.lngVenueID) ON
tblEventType.lngEventTypeID = tblEvent.lngEventTypeID"

If MyValue = "All" Then
strSQL = strSQL & ";"
Else
strSQL = strSQL & " WHERE (((tblVenue.Region)='" & strRegion & "'));"
End If

--
Wayne Morgan
MS Access MVP
"Neil H" <ne**********@ntlworld.com> wrote in message
news:41**********************@news.newsgroups.ws.. .
Hi All

I am doing a multiple table and field database search, and my problem
lies in the options that a user has. In each field, the user can specify
a specific value or any value. I take each value from the form and store
them as variables which are passed onto another asp page. I then have an
SQL statement constructed which takes these variables as conditions and
returns matching records. If they choose a specific value for each
field, there is no problem but if they choose "All", I want to be able
to use the same SQL statement as well.

Heres a bit of code that works if strRegion is equal to a value stored
in the table, ie London, Scotland etc.

SELECT DISTINCT tblVenue.Area FROM tblEventType INNER JOIN (tblVenue
INNER JOIN (tblEvent INNER JOIN tblLINKVenue_Event ON
tblEvent.lngEventID = tblLINKVenue_Event.lngEventID) ON
tblVenue.lngVenueID = tblLINKVenue_Event.lngVenueID) ON
tblEventType.lngEventTypeID = tblEvent.lngEventTypeID WHERE
(((tblVenue.Region)='"&strRegion&"'))"

How do i incorporate "All"?. If coice is "All" I was thinking about
making strRegion = London OR Wales OR Scotland OR etc etc etc. Is there
a quicker way of doing this?

Thanks Again


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Matt | last post by:
In ASP page, there is a "SELECT ALL" button, when user click it, it will select all checkboxes. I am not sure should I use client-side code to do that? the following is my approach but it didnt...
3
by: Adam Toline | last post by:
In reference to the following: http://www.bellecose.com/form.htm At the top of each column there is a box for "All". When one is checked I need to check all of (and only) those boxes...
3
by: tobhamlet | last post by:
If one is using a query as a Row Source on a Form, is there a way to set up a blank space, or to insert the word "ALL" in a combo box that represents ALL combo box row items. The scenario is as...
6
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is...
3
by: Brett | last post by:
I have a textbox with width of 504 and height 248. It gets filled with much content so there is a vertical scroll bar present. When I click into this box and do Ctrl + A, it should highlight...
6
by: Mark | last post by:
I first read about this in mvps.org, but the code he gives doesn't seem to work for my form. I"ll post my code below. I'd love it if someone could point out the error in my code. BTW, this is my...
2
by: bhdvir | last post by:
Does anybody have any advice on selecting all records within a iif-statement? I have a form in which one has to state if all projects or just a selection of projects are to be used for a query....
4
by: 159789 | last post by:
Hi, I am new to javascript. I want to select all the checkboxes or deselect all in a form, based on the state of one checkbox. Here is the code: <html> <script language="JavaScript">...
4
by: WiseG1rly | last post by:
Hey everyone! Still working on a site I posted for a while ago. Essentially I have a search function that is populated through by a database in mySQL and PHP. I need a few things to help the...
0
kcdoell
by: kcdoell | last post by:
Hello: I have a form that I am using to help me display a query that I have built. On that form I have multiple combo boxes that I have called cobMonth, cobYear, cobWorkingRegion, etc......
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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?
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
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...

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.