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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add an "ALL" in Combo Box

Status
Not open for further replies.

legs00

Programmer
Oct 17, 2001
36
CA
Hi,
I have a combo box that is populated from a recordset. What I would like to do is to add another row in the combo box that is blank which means the same as ALL.
Is it possible to do that?? If so, can you please help me with it.
Thanks
Legs
 
There's a lot easier way to do this...

In the rowsource of the combo use

"Select Fieldname from Mytable UNION Select "All" from Mytable"

Of course if you're doing two rows, you'd use

"Select MyKey,Fieldname from Mytable UNION Select "0","All" from Mytable"
 
I tried the "all" but I get an error.

"The value you entered isn't valid for this field
For example, you may have entered text in a numeric field or a number that is larger than the FieldSize setting permits."

Now the information that is in the combo box are dates Medium (Type) that come from a table. Now What I would like to do is give the user the option to either choose a specific date that comes from the table or choose all the dates by choosing "ALL" or having a blank rowsource.

Is it possible to do????
 
Are you trying to enetr criteria for a report or is this for data entry?
 
I have a form that has two combo boxes one is for the project number and the other is for the week. Once the user chooses his criterias, there is a query that runs and the results are shown in the subform.
The extra option that I would like to give the user is the ability to choose all of the weeks by having a blank rowsource or a ALL in a rowsource.
Right now there is no report.
Thanks
Legs
 
Here's how I do it. If the user leaves the combo box empty (doesn't click an option at all) then I assume "all" in my queries.


sample code:

Dim Criteria as string
Dim strSQL as string
Dim strAnd as string

strSQL = "Select * from table1 "
Criteria = "Where "
strAnd = ""
If not(IsNull(me!combo1 )) then
Criteria = Criteria & "field1 = " & me!combo1
strAnd = " and "
end if

If not(IsNull(me!combo2)) then
Criteria = Criteria & strAnd & "Field2 = " & me!combo2
end if
Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top