list box help

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

Guest

I would like to have two list boxes on a form. one list box, Person, would allow me to select the person assigned to a project. The second list box, Projects, would should the list of projects associated with the selection from the person list box. I have set the onclick event for the push the select person to a textbox, this works. But, the second list box remains blank. I tried setting the criteria for the projects query to me!person, since both unbound list boxes are on the same form, but i get a pop-up box asking for the me!person data. When I type enter the requested information, the Projects list boxes is then filled. Is there an easier way to do this or am I doing this total wrong?

Thanks for your assistance.

Jeffery, sr.
 
Jeffery allison said:
I would like to have two list boxes on a form. one list box, Person,
would allow me to select the person assigned to a project. The
second list box, Projects, would should the list of projects
associated with the selection from the person list box. I have set
the onclick event for the push the select person to a textbox, this
works. But, the second list box remains blank. I tried setting the
criteria for the projects query to me!person, since both unbound list
boxes are on the same form, but i get a pop-up box asking for the
me!person data. When I type enter the requested information, the
Projects list boxes is then filled. Is there an easier way to do
this or am I doing this total wrong?

Thanks for your assistance.

Jeffery, sr.

Let me clarify: the Person list box is a single-select (i.e., not
multiselect) list box in which you select a person. After you select
that person, the Projects list box should show all the projects for that
person. Correct?

Set the rowsource query for the Projects list box to a query that refers
to the Person list box. You can't use "Me!Person" to refer to this,
however, because queries don't understand the "Me" keyword. Instead,
your criterion must be a reference via the Forms!FormName reference;
e.g.,

Forms!NameOfYourForm!Person

Then you need to requery the Projects list box whenever the Person list
box is updated, so you need code in that list box's AfterUpdate event:

Private Sub Person_AfterUpdate()
Me!Projects.Requery
End Sub
 
Back
Top