Combo Boxes - How to select ALL records

G

Greg

I have cascading combo boxes which are working fine, but how do I make them
so that the user can either select a specific item in any particular combo
box or ALL records for that combo box.

i.e. Combo Boxes: 1. Group
Select Group A
2. Category
Select ALL

I hope I have made sense.

Your help in this matter is greatly appreciated.

Greg
 
S

strive4peace

Hi Greg,

build the RowSource code for the combo on the GosFocus event -- see what
is filled out and set criteria accordingly. On the LostFocus event,
show all records.

-- if you need help with the SQL, read this:

Access Basics
http://allenbrowne.com/casu-22.html
This 30-page training tutorial will orient you toward the core concepts
of Microsoft Access -- good foundation for learning programming

if you still have questions, post back and we can help you more


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
A

Aaron Kempf

if you want this 'ALL' functionality then you should use Analysis Services
and the PivotList control

it's a TON easier than anything you want to write by hand
 
G

Guest

Greg,

I think I had the same problem. Here is what I did. I have a button on my
form and in the on click event I have this code. It will check all records
that are filtered. So we use the filter buttons to select the records we
want then use this function to check them. The field that I am checking is
called "specialprint". Then I made another button that unchecks all records.


Private Sub Command87_Click()


DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

If (Len(Me.Filter) > 0) Then
CurrentDb().Execute "UPDATE " & Me.RecordSource & " SET SpecialPrint = "
& True & " WHERE " & Me.Filter, dbFailOnError
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End If

Exit Sub

End Sub
 
P

Paul Shapiro

If you just want either a single selection or ALL, you can use a Row Source
query that is something like (I think the syntax may need some fixing,
especially for the Order By clause, so try without that first):
(Select groupID, groupName From Group)
Union All
(Select Top 1 0 as ID, "(ALL GROUPS)" From Group)
Order by groupName

If you want the user to be able to select 0, 1 or more rows, use a listbox
instead of a combo box and set it's MultiSelect property to either Simple or
Extended.
Paul Shapiro
 

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