Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with list box on a subform

Status
Not open for further replies.

greymonkey

Technical User
Jul 20, 2003
29
0
0
AU
Hi all,

I have a main form with staff details on it and then a sub form with the days off the staff have.

I want to have a list box showing all the days off that member of staff has had and then on click go to that record.

BUT I can only get the list box to display all days off for all members of staff.

Any ideas how to limit the list box to just relevant records and still have it as a lookup list box.

Cheers,
 
Hi

The query which populates the list box needs to have a criteria of the id of the staff member currently displayed on the (main) form, without knowing more about your application, you may need to requery the listbox in teh on current event of the main form

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
One way is to build this via a wizard. Otherwise you need to make sure your underlying query for the subform has the key of the main form and then you put the two linking fields (main and subform) in the properties box (can't remember which). They are something like ???chidlink and ???parentlink, very roughly. You'll find them.

Access will do this automatically for you if you have a relationship defined (if you are using base tables) or if the field names are identical in each table/query.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top