473,785 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Ev ent ON
tblEvent.lngEve ntID = tblLINKVenue_Ev ent.lngEventID) ON
tblVenue.lngVen ueID = tblLINKVenue_Ev ent.lngVenueID) ON
tblEventType.ln gEventTypeID = tblEvent.lngEve ntTypeID WHERE
(((tblVenue.Reg ion)='"&strRegi on&"'))"

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 2391
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_Ev ent ON
tblEvent.lngEve ntID = tblLINKVenue_Ev ent.lngEventID) ON
tblVenue.lngVen ueID = tblLINKVenue_Ev ent.lngVenueID) ON
tblEventType.ln gEventTypeID = tblEvent.lngEve ntTypeID"

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

--
Wayne Morgan
MS Access MVP
"Neil H" <ne**********@n tlworld.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_Ev ent ON
tblEvent.lngEve ntID = tblLINKVenue_Ev ent.lngEventID) ON
tblVenue.lngVen ueID = tblLINKVenue_Ev ent.lngVenueID) ON
tblEventType.ln gEventTypeID = tblEvent.lngEve ntTypeID WHERE
(((tblVenue.Reg ion)='"&strRegi on&"'))"

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
8435
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 work. <script language="JavaScript"> function selectAllCheckBox() { //alert(document.addzone.c1.value); document.addzone.c1.value = "on"; } </script>
3
2459
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 underneath. Now, the rub here is that every checkbox on the page (except the "All"s)
3
4515
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 follows. I have two combo boxes. One for COURSECODEs and one for SECTIONCODEs. I select a COURSECODE from teh 1st combo box. Then, from the 2nd combo box I want to select ALL SECTIONCODEs (associated with the COURSECODE). This is for MS Access...
6
9353
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 a checkbox with a control source named "MARK" (boolean) from customer table. I can check and uncheck individual records fine. Then I created 2 command buttons named "Select All" and "Deselect All". The Onclick property of these buttons runs code...
3
4086
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 everything. However, nothing happens. I have to click into the box, hold down Shift and page down to get everything. Is there a way to enable the select all option? Thanks, Brett
6
3937
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 very first time here and I will look forward to sifting through all of the posts and answers. Thanks in advance!!! I don't get an error when using the value option...but if I switch to a Table/Query, I get the following error:
2
5870
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. If "all projects" are required the query should show all records. In the example below the iif-statement should select all projects or just "projectnumber 2". I tried the following as criteria but none is working:
4
3543
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"> function toggleChecked(oElement) { oForm = oElement.form; oElement = oForm.elements; alert("oElement :"+ oElement.length);
4
3536
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 finishing touches on this... I need to have a "select all" option in each pulldown menu that will select all rows, and pass them onto the next page so that they can still be selected. Hopefully this makes sense. Here is the code for the first...
0
1285
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... (basically these are certain field names in my query). I also have a command button called “Run query”. Currently, I have designed it so that if I select any of the options in my dropdown list I am able to narrow down my query result. I accomplished this by...
0
10356
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10100
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.