Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add All To List Function

Status
Not open for further replies.

Tigerlili3

Technical User
Apr 23, 2004
98
US
I'm trying to use the AddAllToList function from microsoft's knowledge base article 210290. It does add 'all' to the combo box list. However, if I select 'all' from the list, the combo box does not display anything. It is just blank. If I make any other selection from this combo box, my selection is displayed as expected. Does anyone know how to get it to display 'all' in the combo box when I select 'all'?
 
Check the combo box property “Bound Column”. If its set to anything but zero, the “All” will not highlight.
 
Is there any way to make this work for more than one control?
 
How are ya Tigerlili3 . . .

The function to add [blue]All[/blue] apparently does its job just fine. What it can't do is decide what action to take when [blue]All[/blue] is selected! . . . [blue]thats your department![/blue]

In the [blue]AfterUpdate[/blue] event of the listbox, you'll need something like:
Code:
[blue]   If Me!ListboxName.Column(x) = "All" Then
      'Code for All
   Else
      'Code for Not All
   End If[/blue]

Calvin.gif
See Ya! . . . . . .
 
I've already taken care of the action it takes when 'all' is selected. What I need to know is whether I can use it for more than one control on a form at a time? For example, I have a form with several combo boxes on it where the user will make a selection. In more than one of these, I'd like to offer 'all' as an option. Using AddAllToList works when I'm only using it in one control. However, it is part of the AddAllToList code to produce an error if it is used in more than one control. Is there a way around this?
 
That wasn't what I was asking. I've already taken care of the action it takes when 'all' is selected. What I need to know is whether I can use it for more than one control on a form at a time? For example, I have a form with several combo boxes on it where the user will make a selection. In more than one of these, I'd like to offer 'all' as an option. Using AddAllToList works when I'm only using it in one control. However, it is part of the AddAllToList code to produce an error if it is used in more than one control. Is there a way around this?
 
I do not use the AddAllToList function. As the RowSource I use something like the following:

SELECT Users.UserId, Users.UserName From Users UNION Select Null as AllChoice , " (All)" as Bogus From Users
ORDER BY Users.UserName;

Column Count=2
Column Width = 0”,1”
Bound Column = 0

This will list all UserNames from the Users table and adds ‘ (All)’ at the top.

Please note the fields on the left of the UNION must have the same number of made up fields on the right. As in the above: Left fields are UserId and UserName and on the right is AllChoice, a Null, and Bogus as “( All)”.

You can use this example on all the List Boxes or Combo Boxes on the form.
 
Thanks StarPassing. I'm going to use that. It works wonderfully.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top