Adding and Selecting "All" to Combo Box???

T

TotallyConfused

I have a combo box with a source type of Value list and month and year listed
for two years. You can only choose 1 item to select. Is there any way to
be able to choose multiple items at one time?? Also to add "All" to the list
to be able to choose all the items if needed? Thank you very much for any
help you can provide.
 
M

Mike Painter

TotallyConfused said:
I have a combo box with a source type of Value list and month and
year listed for two years. You can only choose 1 item to select.
Is there any way to be able to choose multiple items at one time??
Also to add "All" to the list to be able to choose all the items if
needed? Thank you very much for any help you can provide.

Not in a combo box but you can in a list box.

If the list is not huge and the selections are likely to remain the same for
a time there is another approach.
Add a "yes/no" called "Selected" checkbox to your table.
Create a subform set to dataview and add the fields you need.
Add a button for "select all" and "clear all" that sets the boolian field to
True or False.
The report, etc, is based on Selected = True.

My first app using this allowed a lab tech to run reports based on one or
more doctors running a set of tests.
 
T

Tommo

I want to do the same thing as TotallyConfused so this thread is really
helpful.
I have tried putting the "Select All" button in the Detail Section, the Page
Header Section and the Form Header Section but it never appears when I run
the form.
What am I doing wrong?
 
B

BruceM via AccessMonster.com

You can have a multi-select list box (not combo box), but to what end? That
is, what would you have happen after you select several items or "(All)"?

To add "(All)" you can use something like what is shown here:
http://www.mvps.org/access/forms/frm0043.htm

However, you should note that the example assumes two columns, the first
Number and the second Text. It seems you have a Month field and a Year field.
BTW, you should not use Month or Year as field names, as they are reserved
words. Typically you would store a single date field, and use a query to
break it into month and year columns. Without knowing something of how your
data are organized it is not possible to be specific about how you may
construct the Row Source query.

The following shows how to use a multi-select list box to filter a report.
It may apply to your situation:
http://allenbrowne.com/ser-50.html
 
T

TotallyConfused

Thank you very much for your response and suggestions. I have a form where I
select the items from a combo box. The list consists of Month and Year one
column. Once I select an item, I click on command button and report opens
with the cases for the month selected.

My combo box is like the last example in the www.mvps.org/access/forms page.
I took the code shown on this page

Private Sub Form_Open(Cancel As Integer)
With Me.Combo0
.RowSourceType = "Value List"
.RowSource = "(ALL);" & .RowSource
End With
End Sub

I put this is the open Even on the form. But this did not work. Can you
help me revise this? Thank you.
 
B

BruceM via AccessMonster.com

That example assumes the combo box already has a Value List as its Row Source,
or that the Value List is defined elsewhere in the code. If it does not, the
code will not do anything useful. Since you want months and years I assume
you would want new months and years added as time goes by, in which case you
want a Table/Query as the Row Source. That means you would use the other
option in the example. I could help with that, but I don't know how you are
getting the drop-down list you have now (without the "(All)"). If it is a
query, post the SQL. To do that, open the query in design view, then click
View >> SQL. Copy what you see there. If it is an expression on the
property sheet, copy that.

What is the code for opening a report for the selected month and year?
Thank you very much for your response and suggestions. I have a form where I
select the items from a combo box. The list consists of Month and Year one
column. Once I select an item, I click on command button and report opens
with the cases for the month selected.

My combo box is like the last example in the www.mvps.org/access/forms page.
I took the code shown on this page

Private Sub Form_Open(Cancel As Integer)
With Me.Combo0
.RowSourceType = "Value List"
.RowSource = "(ALL);" & .RowSource
End With
End Sub

I put this is the open Even on the form. But this did not work. Can you
help me revise this? Thank you.
You can have a multi-select list box (not combo box), but to what end? That
is, what would you have happen after you select several items or "(All)"?
[quoted text clipped - 19 lines]
 
M

Mike Painter

Tommo said:
I want to do the same thing as TotallyConfused so this thread is
really helpful.
I have tried putting the "Select All" button in the Detail Section,
the Page Header Section and the Form Header Section but it never
appears when I run the form.
What am I doing wrong?

If the button does not appear I can only assume you have set it's visible
property to False or made it real small.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top