By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,584 Members | 3,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,584 IT Pros & Developers. It's quick & easy.

Populate multi-list box based on selections in a different multi-list box

P: n/a
Joe
I have 2 multi-list boxes, 1 displays course categories based on a
table called CATEGORIES. This table has 2 fields CATEGORY_ID,
CATEGORY_NAME

The other multi-list box displays courses based on a table called
COURSES. This table has 2 fields CATEGORY_ID, COURSE_NAME.

The CATEGORY_ID is a FK in COURSES and a PK in CATEGORIES.

I want to populate the course list box based on any category(s)
selected in the 1st multi-list box. How would I go about doing
something like this?

Nov 13 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a

Joe wrote:
I have 2 multi-list boxes, 1 displays course categories based on a
table called CATEGORIES. This table has 2 fields CATEGORY_ID,
CATEGORY_NAME

The other multi-list box displays courses based on a table called
COURSES. This table has 2 fields CATEGORY_ID, COURSE_NAME.

The CATEGORY_ID is a FK in COURSES and a PK in CATEGORIES.

I want to populate the course list box based on any category(s)
selected in the 1st multi-list box. How would I go about doing
something like this?


beats the hell outta me why you'd use a listbox when you can only
select a single value - (use a combobox instead!), but here's the
code...
http://www.mvps.org/access/forms/frm0028.htm

Nov 13 '05 #2

P: n/a
Joe
These are both multi-list boxes where the user can select multiple
values in both boxes. If the user selects 3 course categories for
example, I want the 2nd multi-list box to be populated with all the
courses under those 3 categories and be able to choose as many courses
as needed.

Nov 13 '05 #3

P: n/a
Joe wrote:
These are both multi-list boxes where the user can select multiple
values in both boxes. If the user selects 3 course categories for
example, I want the 2nd multi-list box to be populated with all the
courses under those 3 categories and be able to choose as many courses
as needed.


But...a multi-select ListBox's selections can only be retrieved with code as it
will always have a value of Null. Is it your intention that the multiple
selections made in the second ListBox be stored somewhere?
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4

P: n/a
Joe wrote:
I have 2 multi-list boxes, 1 displays course categories based on a
table called CATEGORIES. This table has 2 fields CATEGORY_ID,
CATEGORY_NAME

The other multi-list box displays courses based on a table called
COURSES. This table has 2 fields CATEGORY_ID, COURSE_NAME.

The CATEGORY_ID is a FK in COURSES and a PK in CATEGORIES.

I want to populate the course list box based on any category(s)
selected in the 1st multi-list box. How would I go about doing
something like this?
You write code in the after_update event of the first listbox that uses
the .selected property to build a query expression which you set as the
rowsource property of the second listbox.
From Access 97 Help: The Selected property is an array of values from 0

to the ListCount property value minus 1. For each item in the list box
the Selected property will be True (-1) if the item is selected and
False (0) if it is not selected.

Bob

Nov 13 '05 #5

P: n/a
Joe,

I have developed a calendar schedule module that I thought you might be
interested in having it implemented in your database. It was developed for a
database used to schedule training classes. The training facility can be
selected to limit the training classes displayed in the calendar to a
specific facility. You can change the month and year of the calendar to
limit the training classes displayed in the calendar to a specific year and
month in that year. By simply making a new selection in one of the
drop-downs, you can change what faciity the training classes are diaplayed
for and what month and year the training classes ocurred. To schedule a new
class, you click on one or more dates for the class in the calendar and then
click the "Schedule" button in the menu at the top of the screen. The
"Schedule" button opens a form to add a new training class on the dates you
previously selected. You can also click on any day to edit the schedule of
the classes shown on that day. At any time, you can click on Print in the
menu at the top of the screen and printout the calendar that is on the
screen. The calendar schedule module can be easily modified to meet your
specific needs. I can email you a screen shot of the calendar schedule
module if you are interested.
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Joe" <jc**********@comcast.net> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
I have 2 multi-list boxes, 1 displays course categories based on a
table called CATEGORIES. This table has 2 fields CATEGORY_ID,
CATEGORY_NAME

The other multi-list box displays courses based on a table called
COURSES. This table has 2 fields CATEGORY_ID, COURSE_NAME.

The CATEGORY_ID is a FK in COURSES and a PK in CATEGORIES.

I want to populate the course list box based on any category(s)
selected in the 1st multi-list box. How would I go about doing
something like this?

Nov 13 '05 #6

P: n/a
Joe
Both multi-list boxes are displaying table data. For example. when the
form loads, the category multi-list box is loaded from a table and the
categories for the current student are selected in the multi-list box.
I have that working correctly by VBA code on the the form's current
property.

After the categories are selected, I want to make the course multi-list
box visible, load it with courses related to the selected categories
only.

All data loaded in the multi-list boxes will be stored in seperate,
related tables.

Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.