Doing a simple query for a list box

pfiroz

Registered User.
Local time
Yesterday, 22:10
Joined
Jan 21, 2009
Messages
27
Hi,
I haven't done any Access in a while and cant remember how to do this simple thing. I just want to query a suppporting materials table so that all the supporting filenames appear in a list box for a particular person. So I have two tables, One is called Main with all the people each with a person_id. The other table has a person_id associated with multiple supporting materials. So when I try to put a list box on my main form and do the query, how to I get the Person_id that is for the current record on table main into the list box query so that it will only list the supporting materials for that person!?
Thanks for any help!:)
-
 
1. Have the person log into the database and store that value somewhere on a form. Ususally a hidden text box on the main form / menu. Read that textbox from within the query you use to create the list.

From the query designer use the builder to find the field on the form or use =Forms![Form Name]![Text box]
 
Hi Thanks for that input. So my form is called frmMain and the text box that is already on the form that has Entity_id is called Entity ID.
So where would I put Forms![frmMain]![Entity ID] on the form? The unbound list box is also on the form and has the following query in it's row source
Code:
SELECT tblSupportingMaterials.LinkItem_ID, tblSupportingMaterials.Entity_ID, tblSupportingMaterials.FileName FROM tblSupportingMaterials WHERE (((tblSupportingMaterials.Entity_ID)=[frmMain]![Entity ID])) ORDER BY tblSupportingMaterials.LinkItem_ID, tblSupportingMaterials.FileName; 
[code]
But when I open the form it asks me for the value frmMain]![Entity ID])
 
Appreciate your help!
 
I'm missing something probably small but it's not obvious to me how to get the Entity_ID in frmMain (which is based on tblMain) and the Entity_ID in tblsupportingmaterials to match up. This list box on frmMain is based on and queries tblsupportingMaterials.
 

Users who are viewing this thread

Back
Top Bottom