View Full Version : Subform linked to parent form data


sarthur
04-23-2001, 12:16 AM
I have a form with a combo box showing the Company Name based on the Company ID. The form has a sub-form showing the Employees Name in a combo box. I want the combo box of Employees Name to only show the employees of the company selected in the Company Name combo box (The Employee Table has a Company ID field). I think I should be using Requery, but I can't get it to work. PS: This is causing BIG stress!

lorraine
04-23-2001, 01:04 AM
Try setting the default value of companyid in the subform to the companyid on the main form if the relationship is one to many this should only bring up the employees linked to the particular company.

sarthur
04-23-2001, 03:43 PM
Thanks for your reply Lorraine. I finally worked it out last night:
I had already linked the Employee Name to the Company Name using the Company ID in a Query. This brought up the correct listing for the FIRST record, but when I was changing to another record, the Query needed to be run again. Finally I worked out that this should be done using Requery in the On Current event of the main form. Now the Employee Name list shows only those in the Company!