473,386 Members | 1,790 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.

Select records based on three different combo boxes

How can you select records based on more than one combo box -
I have a combobox that selects records based on name
(I'm sure this has been asked a thousand times - web site answer/link
could be helpful too; but I'm so bad with syntax that specifics will
be MOST helpful)

SELECT DISTINCT [qryAE_ProtocolsSponsors].[PI Last Name],
[qryAE_ProtocolsSponsors].[PI First Name] FROM
[qryAE_ProtocolsSponsors] Union Select "<ALL>" , NULL From
[qryAE_ProtocolsSponsors];

and sorts the results:
If Me![Combo24] = "<All>" Then
DoCmd.ShowAllRecords
Me.OrderBy = "[PI Last Name] ASC"
Me.OrderByOn = True
Else
DoCmd.ApplyFilter , "[PI Last Name] =
Forms![Form-ProtocolsSponsors]![combo24]"
Me.OrderBy = "qryAE_ProtocolsSponsors.[Current Status] ASC"
'Me.OrderBy = "[Sponsor] ASC"
Me.OrderByOn = True
End If

1 How can I sort by Current Status THEN by Sponsor? so all those of
one status are sorted by sponsor and the next status are sorted by
sponsor, also?)
2. How can I set up two combo boxes so that combo 1 limits the record
set then combo 2 further limits the record set.
Then use a button to Show all records.

Thanks so much in advance!!

-warning e-mail address altered- arthureNOSPACE@
Nov 13 '05 #1
1 2622
I'm sorry I dont have time for a long response.

I often use forms with a listbox for navigation and I use several
combos to filter the recordset of this listbox. For the recordsource
of the combos I use two queries - the first to sort the list, then the
second to add an 'ALL' to the top of the list.

In the recordsource of the listbox I have the criteria set as the
value of those combos boxes with IIF statements incase the user
selects all:

IIf([Forms]![frmNewDataRequest]![cmboSelectByPriority]=0,([tblRequests].[Priority]),[Forms]![frmNewDataRequest]![cmboSelectByPriority])

This works great for me. Hope it helps a bit.

Lincoln King
Sydney Australia

arthur-e <ar*****@ix.netcom.com> wrote in message news:<ih********************************@4ax.com>. ..
How can you select records based on more than one combo box -
I have a combobox that selects records based on name
(I'm sure this has been asked a thousand times - web site answer/link
could be helpful too; but I'm so bad with syntax that specifics will
be MOST helpful)

SELECT DISTINCT [qryAE_ProtocolsSponsors].[PI Last Name],
[qryAE_ProtocolsSponsors].[PI First Name] FROM
[qryAE_ProtocolsSponsors] Union Select "<ALL>" , NULL From
[qryAE_ProtocolsSponsors];

and sorts the results:
If Me![Combo24] = "<All>" Then
DoCmd.ShowAllRecords
Me.OrderBy = "[PI Last Name] ASC"
Me.OrderByOn = True
Else
DoCmd.ApplyFilter , "[PI Last Name] =
Forms![Form-ProtocolsSponsors]![combo24]"
Me.OrderBy = "qryAE_ProtocolsSponsors.[Current Status] ASC"
'Me.OrderBy = "[Sponsor] ASC"
Me.OrderByOn = True
End If

1 How can I sort by Current Status THEN by Sponsor? so all those of
one status are sorted by sponsor and the next status are sorted by
sponsor, also?)
2. How can I set up two combo boxes so that combo 1 limits the record
set then combo 2 further limits the record set.
Then use a button to Show all records.

Thanks so much in advance!!

-warning e-mail address altered- arthureNOSPACE@

Nov 13 '05 #2

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

Similar topics

19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
3
by: Stig | last post by:
Hi, Any help on this one will be greatly appreciated as I have spent too long banging my head against the screen trying to get it sorted. Basically I would like to have a select all records...
5
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and...
2
by: Mark Roughton | last post by:
I have a form where the users need to view records for various criteria, one of which is a date field on which they may wish to view all related data for the selected date, for all dates upto and...
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
6
by: jmartmem | last post by:
Greetings, I have an Access 2002 continuous form called "Project Update Form" in which users can update project values presented in a series of combo boxes and text boxes. Three of the combo...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
5
by: dantebothermy | last post by:
Hi all, I have a form with a subform. On the form is a combo box with three choices "current", "former" and "all". I'd like to use that combo box to set the data source for the subform based on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.