473,769 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combobox - option ALL

Is it possible to add an option ALL in the ist of a combobox that get its
values from a table?

Example:

in the combobox are the items from the table "days": monday, th....
The chosen value from the combobox is used in a query to select only the
records of the chosen day.
Now I want to have the possibility to have also ALL in my combobox-list to
select the records for all the days.

txs
Piet
Nov 12 '05 #1
4 2670
piet wrote:
Is it possible to add an option ALL in the ist of a combobox that get its
values from a table?

Example:

in the combobox are the items from the table "days": monday, th....
The chosen value from the combobox is used in a query to select only the
records of the chosen day.
Now I want to have the possibility to have also ALL in my combobox-list to
select the records for all the days.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Perhaps a criteria like this (assumes the ComboBox has 2 columns: the
first column [bound column] is the days' week numbers; the second column
is the name of the week day - ALL has a NULL week day number):

PARAMETERS Forms!FormName! cboWeekDays Date;
SELECT ... etc.
WHERE Forms!FormName! cboWeekDays IS NULL OR
(Forms!FormName !cboWeekDays IS NOT NULL
AND WeekDay(DateCol umn) = Forms!FormName! cboWeekDays)

[Change the names to suit your set up]

If ALL is selected, in the ComboBox Forms!FormName! cboWeekDays, IS NULL
evaluates to TRUE and all records are retrieved. If ALL is not selected
the OR (...) part of the criteria evaluates to true & selects only
records that have the date column w/ the required weekday value.

I got the above criteria idea from a db of samples queries from MS:

http://support.microsoft.com/default...b;en-us;182568
- --
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQG6PBoechKq OuFEgEQJG9gCfUs yTIa1AABnsjvUbZ U3isSwDq+EAnRI2
1pM+Db1j/miKtZEMaWsPt3vw
=222i
-----END PGP SIGNATURE-----

Nov 12 '05 #2
piet wrote:
Is it possible to add an option ALL in the ist of a combobox that get its
values from a table?

Example:

in the combobox are the items from the table "days": monday, th....
The chosen value from the combobox is used in a query to select only the
records of the chosen day.
Now I want to have the possibility to have also ALL in my combobox-list to
select the records for all the days.

txs
Piet

I would use MG's solution for the query. If you want a word like ALL
into the combo I do something like this.

Assume I have an employee table; EmpID (Numberic, hidden in combo) and
EmpName (text and displayed in combo).

Select EmpID, EmpName From Employees
UNION
Select 0, "(All)" As EmpName From Employees
Order by EmpName

The select line after the union creates a dummy record.

I usually put () around the word All since a "(" is less than numbers
and characters and it will float to the top of the list. This is handy
if you have a field like EmpName where the word Albert would be less
than All in a sort order. I guess you could use a space if front of the
word All too.


Nov 12 '05 #3
"Salad" <oi*@vinegar.co m> wrote in message
news:9y******** **********@news read1.news.pas. earthlink.net.. .
piet wrote:
Is it possible to add an option ALL in the ist of a combobox that get its values from a table?

Example:

in the combobox are the items from the table "days": monday, th....
The chosen value from the combobox is used in a query to select only the
records of the chosen day.
Now I want to have the possibility to have also ALL in my combobox-list to select the records for all the days.

txs
Piet

I would use MG's solution for the query. If you want a word like ALL
into the combo I do something like this.

Assume I have an employee table; EmpID (Numberic, hidden in combo) and
EmpName (text and displayed in combo).

Select EmpID, EmpName From Employees
UNION
Select 0, "(All)" As EmpName From Employees
Order by EmpName


I usually create a dummy table with a single row for these queries, that way
I can use union all and avoid the performance penalty of union. Also, you
can use a second sort column to make sure (All) is positioned at the top,
even if there are other records which would normally sort before "(All)",
such as those with leading spaces.

The query becomes:

select EmpID, EmpName, 1 as sort from Employees
union all
select 0, "(All)", 0 from dummy
order by sort, EmpName
You can create a dummy table that will only allow a single row like so:

Sub createDummy()
Dim sql As String
sql = "create table dummy(id int not null primary key, constraint
CK_dummy_id check(id=0))"
CurrentProject. Connection.Exec ute sql
End Sub






Nov 12 '05 #4
OM
There's an answer to this in the FAQ's for this group, I've seen it.Go to

http://www.mvps.org/access/netiquette.htm

and have a look.

OM
"MGFoster" <me@privacy.com > wrote in message
news:ja******** **********@news read1.news.pas. earthlink.net.. .
piet wrote:
Is it possible to add an option ALL in the ist of a combobox that get its values from a table?

Example:

in the combobox are the items from the table "days": monday, th....
The chosen value from the combobox is used in a query to select only the
records of the chosen day.
Now I want to have the possibility to have also ALL in my combobox-list to select the records for all the days.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Perhaps a criteria like this (assumes the ComboBox has 2 columns: the
first column [bound column] is the days' week numbers; the second column
is the name of the week day - ALL has a NULL week day number):

PARAMETERS Forms!FormName! cboWeekDays Date;
SELECT ... etc.
WHERE Forms!FormName! cboWeekDays IS NULL OR
(Forms!FormName !cboWeekDays IS NOT NULL
AND WeekDay(DateCol umn) = Forms!FormName! cboWeekDays)

[Change the names to suit your set up]

If ALL is selected, in the ComboBox Forms!FormName! cboWeekDays, IS NULL
evaluates to TRUE and all records are retrieved. If ALL is not selected
the OR (...) part of the criteria evaluates to true & selects only
records that have the date column w/ the required weekday value.

I got the above criteria idea from a db of samples queries from MS:

http://support.microsoft.com/default...b;en-us;182568
- --
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQG6PBoechKq OuFEgEQJG9gCfUs yTIa1AABnsjvUbZ U3isSwDq+EAnRI2
1pM+Db1j/miKtZEMaWsPt3vw
=222i
-----END PGP SIGNATURE-----

Nov 12 '05 #5

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

Similar topics

2
13270
by: Guillem | last post by:
Hola amigos, necesito realizar un script o algo similar para enlazar dos combobox. Están insertados en html uno detrás del otro y necesito que cuando se seleccione una posición del primero, también se marque automáticamente la misma posición del segundo. Explicándolo de otra manera: Cuando el usuario seleccione el sexto option del primer combobox se tendría que seleccionar automáticamente el sexto option (selected) del segundo combobox....
6
2340
by: Georges Heinesch | last post by:
An easy ComboBox question. ;) I would like to create a ComboBox, which permits to cycle through 3 subforms. These 3 subforms are entered in the ComboBox as Value List. The subforms should only be selectable via the cycle gadget (the button with the arrow right of every ComboBox control) of the ComboBox. How can disable the left part (text part of every ComboBox), so that no entry can be manually made into the ComboBox?
2
1661
by: Prabhat | last post by:
Hi all, I have one combobox where I want to display Name of the Products that are loaded in the collection object. But I am able to send only ID and Name of the Product where ID is the value of the option tag and products name is the display text for option tag. I want to send the Product Version Number to clients browser for ALL Products that are loaded to combobox so that On Change of the combobox the Version Number should display in...
6
3847
by: shailen21 | last post by:
Hi everybody, Im trying to use that piece of javascripts for 2 combo box in my web site but its nt working on Firefox but it works well in IE 6.0 :S Can someone please help me in solving this problem. I included the js functions. The first ComboBox is when the user select an option the URL must may be a pop up and the second ComboBox needs to open the URL within the page itself. Both are using the onChange() function. Thanks for a...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9999
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
9866
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
8876
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
7413
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
6675
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
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.