A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

combobox "all" for query criteria



 
 
Thread Tools Display Modes
  #1  
Old December 8th, 2005, 07:37 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default combobox "all" for query criteria

I am using a combobox to select criteria for a query.
I have finally been able to add "all" to my picklist query
SELECT DISTINCT [Division group cross table].Division
FROM [Division group cross table] UNION select '(ALL)' from [division
group cross table]
ORDER BY [Division group cross table].Division;

However, if I select "all" then my query results do not include any
records. How do I change it so that if I select all, the query does
not limit the criteria to any of the organizations that are listed in
the dropdown?

TIA

  #2  
Old December 8th, 2005, 08:15 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default combobox "all" for query criteria

For two columns, one for display in the combo box, the other a hidden column
(width 0") that will contain the value to be used by the query. This second,
hidden column will be the bound column, so it will be the Value of the combo
box after a selection. You would use Null as the value in the hidden column
when (All) shows in the visible column. In the query, you would then set the
criteria to

[Forms]![Form1]![Combo1] Or [Forms]![Form1]![Combo1] Is Null

This will return all values if the value of the combo box is Null (i.e. if
you select (All)) or the value selected if something else is selected.

For one column, assuming that (All) isn't among the possible selections,
modify the query criteria above to

[Forms]![Form1]![Combo1] Or [Forms]![Form1]![Combo1] = "(All)"

The first method would be used for combo boxes that display a user friendly
column and have an ID column for use by the database. The second method
should work with what you have.

--
Wayne Morgan
MS Access MVP


"papa jonah" wrote in message
ups.com...
I am using a combobox to select criteria for a query.
I have finally been able to add "all" to my picklist query
SELECT DISTINCT [Division group cross table].Division
FROM [Division group cross table] UNION select '(ALL)' from [division
group cross table]
ORDER BY [Division group cross table].Division;

However, if I select "all" then my query results do not include any
records. How do I change it so that if I select all, the query does
not limit the criteria to any of the organizations that are listed in
the dropdown?

TIA



  #3  
Old December 9th, 2005, 04:20 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default combobox "all" for query criteria

My query only has one column.

Can I do this by somehow using code (from the command button on click
event) to provide the same results as having the event run a "query"?

  #4  
Old December 9th, 2005, 04:26 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default combobox "all" for query criteria

Never mind, Wayne. It took me awhile, but I eventually figured out
where I was supposed to insert your suggestion. It looks like it works
great now.

Thank you very much!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Advanced selection Criteria JR Hester Mailmerge 2 November 3rd, 2005 07:24 PM
Returning Results Based on Two Criteria [email protected] Worksheet Functions 7 October 23rd, 2005 02:53 PM
Updating combobox values from another combobox ispy99 General Discussion 3 June 20th, 2005 07:07 PM
combobox filter AliKural New Users 7 May 4th, 2004 11:26 AM
Countif functions with multiple criteria t Worksheet Functions 0 April 5th, 2004 07:11 PM


All times are GMT +1. The time now is 09:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.