dbTalk Databases Forums  

Grouping in Listbox

comp.databases.ms-access comp.databases.ms-access


Discuss Grouping in Listbox in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
BobbyDazzler
 
Posts: n/a

Default Grouping in Listbox - 01-28-2011 , 05:24 AM






Is it possible to group items together in a listbox?

I have tblproduct which includes producttypeid as a foriegn key from
tblproducttype

I want to be able to list products grouped together under their
Product Type (as a heading)

If this is not opssible with a listbox, any methods you have used as a
workaround would be most appreciated.

Thanks

Reply With Quote
  #2  
Old   
Rick Brandt
 
Posts: n/a

Default Re: Grouping in Listbox - 01-28-2011 , 06:18 AM






BobbyDazzler wrote:

Quote:
Is it possible to group items together in a listbox?

I have tblproduct which includes producttypeid as a foriegn key from
tblproducttype

I want to be able to list products grouped together under their
Product Type (as a heading)

If this is not opssible with a listbox, any methods you have used as a
workaround would be most appreciated.

Thanks

What I did once was to construct a query so that it returned two columns.
One numeric and one text. The text contained both group headings and items,
but with the Items padded with a few spaces...

Group 1
Item 1
Item 2
Group 2
Item 1
Item 2
Item 3
etc..

The numeric column (hidden) had zeros in the group rows and ones in the item
rows. I used the Change event to test for a zero in that column and when
detected the code would change it so what was selected was the first item in
that group. Essentially you could not select the rows with group names,
only those with items.

If one were building a multi-select ListBox I suppose you could make it
where selecting a group row resulted in all of the associated item rows
being selected automatically.

Reply With Quote
  #3  
Old   
Access Developer
 
Posts: n/a

Default Re: Grouping in Listbox - 01-28-2011 , 02:09 PM



"BobbyDazzler" <david.a.mitchell (AT) inbox (DOT) com> wrote

Quote:
Is it possible to group items together in a listbox?
Rick has given you one workaround, that could permit selecting all items in
the group.

Another approach would be to use a continuous forms Form embedded in a
Subform Control, with order determined by using a Query as the Record Source
of the embedded Form. As with Rick's approach, you could use VBA event code
to select either all records in a group, or individual records. I tend to
think it would be somewhat easier to accomplish using the Subform approach,
but, having done neither, that's only a guess and would also depend on your
experience with multi-select Listboxes and Subform Controls with continuous
forms view Forms embedded.

Larry Linson
Microsoft Office Access MVP

Reply With Quote
  #4  
Old   
BobbyDazzler
 
Posts: n/a

Default Re: Grouping in Listbox - 02-01-2011 , 09:16 AM



Thank you both for taking the time to respond. I'll try and implement
your suggestions.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.