Headings in a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Novice/Access 2003/Windows XP

Is there a way to divide a list in a combo box into categories that have
non-selectable headings?

In the following example, I don't want the user to be able to click on the
headings (Galleries, Museums, and Parks & Gardens)--only the selections after
the headings.
Galleries
Art Gallery
Sculpture Gallery
Museums
Archaeology Museum
Military Museum
Natural History Museum
Parks & Gardens
Botanic Garden
Garden
Park

I don't care how the list items are distinguished from the headings (leading
spaces, leading dash, bold headings).

Thank you

Peter
 
not easily.

headings should not be appearing in the data itself .... kind of as a
fundamental rule of DB and so there is no easy way to deal with it since it
isn't suppose to be structured this way in the first place........sorry
 
Novice/Access 2003/Windows XP

Is there a way to divide a list in a combo box into categories that have
non-selectable headings?

Network Trade is right: this is rather difficult to do. What you would
need is some VBA code in the AfterUpdate event of the combo to detect
whether the user had selected a heading (you can't prevent them from
doing so) and ignore it, and then take appropriate action if they pick
an item that is selectable.

It would be a lot more common to have two combo boxes, the first with
the headings, and the second dependent upon it with the values
appropriate for that heading. Base the second combo on a Query
referencing the first as a criterion:

=[Forms]![NameOfForm]![cboCategory]

and requery the second combo in the afterupdate event of the first.

John W. Vinson[MVP]
 
Thanks for taking the time, I appreciate the help.

If I have a Column 2 and set a value (say N for Headings and Y for
selectable items) in Column 2, then I can ignore the Headings.

If I have a Column 3, I could put a dash in front of the selectable items in
Column 1 and select the item (without the dash) from Column 3.

What do you think?

Thanks

Peter
 
Thanks for taking the time, I appreciate the help.

If I have a Column 2 and set a value (say N for Headings and Y for
selectable items) in Column 2, then I can ignore the Headings.

If I have a Column 3, I could put a dash in front of the selectable items in
Column 1 and select the item (without the dash) from Column 3.

What do you think?

Thanks

Peter

I've actually done something similar, using a Listbox rather than a
Combo Box, as an alternative switchboard. I have the listbox based on
a four-field query - only one is visible, a human-meaningful name for
a form or report ("Monthly Impounds Report" say); the name of a form
or report ("rptMonthlySoftSlips"); a sequence number; and a field to
indicate the kind of object (form, report, or - though this is unused
at present - action query, or 0 for "label").

I've got code in the Listbox's Doubleclick event to launch the object
referenced in the second column - this code simply returns without
doing anything if the object type is 0.

John W. Vinson[MVP]
 

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

Back
Top