View Full Version : Use Listbox to select Students, then Report where they are from


airforceruss
10-31-2007, 08:46 AM
As the title describes, I have a table full of students and each student has a location from where they are from. When we mail out certificates showing they completed the course it would be nice to be able to generate a list of the locations we need to address an envelope too. There are not an infinite number of locations the student can be from, but rather a finite list that are also stored in a separate table with a Primary Key associated with each student. Pretty simply stuff. Each location could have up to three different statuses (Active, Reserve or Other). So I could have a student from Location 1 with a status of Active which has a different address assocaited with it that Location 1 with a status of Reserve. Each Location (Location 1, Status Active and Location 1, Status Reserve) has a separate entry in it's table.

What I need to be able to do is display a list box of all the students, have the user select all the students that they are mailing certificates out for, and then have the report list the Locations with the Students who are being mailed to that location underneath.

Reports are new to me, so where would I start on this?

Thanks!

WayneRyan
11-04-2007, 08:04 PM
Russ,

Basically, you want to construct a query to feed your report.
The listbox is going to contribute the Where clause.


Select ...
From tblStudents
Where StudentID In (1, 2, 5, 6, 9, ...)


You need to use the QueryDef to make/remake your query and
you need some VBA to build the (1, 2, 5, 6, 9, ...).

Fortunately, Lister has a sample for you:

http://www.access-programmers.co.uk/forums/showthread.php?t=137205&highlight=listbox+lister

hth,
Wayne