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!

How can I get a form field to just list results from another table?

Status
Not open for further replies.

Sugada

IS-IT--Management
Aug 1, 2001
33
0
0
US
I'm trying to list the results from one table to a form depending on what is keyed in or selected from a field on the same form.

For example: If Salaries is selected for my catagory field, How can I get a field with 2001 data to auto fill or just show the results from selecting Salaries. I understand an after_update needs to be used somehow, but when and how does this field get the information from the other table?

Thanks, Sugada
 
Here is how I did it in the system i'm designing:


1) Open your form in regular view and select a combo salary item.
2) Go to the query tab of your database and select new query, use the wizard to base it on your 2001 salary data table that you want the list to show. Include all the fields you want, then finish the query wizard. Open the query in design view and under "Criteria" of your field that contains the salary match to the combo box, select "build..." by right click. Go to loaded forms and double click the value of your salary combo box.
3)this now restricts your query to only show the 2001 data for the salary value that is shown in the combo box. Open the query to see what your list will look like.
4) Open the form your working in into design view, and in the "after update" event of your combo box say 'DoCmd.Requery "Salary2001listbox"' or whatever you name your listbox control as
5) Go to your listbox properties and change the control source property to the name of your query you just created.

*Now after a user selects a combo box value, it will requery your 2001 data salary table and return the fields you specified to the listbox that is on your form.

good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top