Link to home
Start Free TrialLog in
Avatar of SparkyP
SparkyP

asked on

Refresh Combo Box on Subform

I have a main form that has details of Jobs (frmJobReports). This has a tab page with a subform that allows us to provide a price breakdown for any additional costs.

The main form details the equipment we are working on based on the site. There could be any number of pieces of equipment on any site. If we carrying out general maintenance on the Site, we have an equipment record called "SiteNameGeneral".

The costing subform is used to provide quotations against specific equipment on the site.

I use the following code in a query to lookup all plant for that site in a combobox. This works fine first time round, but if a scroll records in the main form and then use the dropdown in the subform combo the records remain on the origin records detail.


SELECT EquipmentList.Plant
FROM EquipmentList
WHERE (((EquipmentList.Site)=[forms]![Job Reports]![cboSite]) AND ((EquipmentList.Archived)="No"));

I have tried every which way with requeries, but cannot get it to work.

Many thanks in anticipation.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

You can requery a combo on a subform like this:

me.NameOfyourSubformCONTROL.Form.YourCombo.Requery

Note that "NameOfYourSubformCONTROL" is the name of the Subform CONTROL on your mainform, and may or may not be the same as the form you're using as a Source Object of that control.
Avatar of SparkyP
SparkyP

ASKER

Thanks for prompt response

To be clear the Control of the subform, is the name you would see if you looked at the tab order of the form?

Which event would you assign the requery, and on which control?

Many thanks
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SparkyP

ASKER

Thanks for the explanations. Works just as I wanted it. Really appreciate your patience.