Solved

Refresh Combo Box on Subform

Posted on 2013-01-21
4
444 Views
Last Modified: 2013-01-21
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.
0
Comment
Question by:SparkyP
  • 2
  • 2
4 Comments
 
LVL 84
Comment Utility
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.
0
 

Author Comment

by:SparkyP
Comment Utility
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
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
Comment Utility
If you click ONCE on the subform, and then review the Properties dialog - you'll generally see it there. For reference, the Subform CONTROL will have only  events (Enter/Exit) and will also have a property named "Source Object".

I'm not sure exactly when you'd fire this code - that would depend  on when you need the subform's control would need to be requeried. Perhaps the main form's Current event, which fires each time you move to a different record.
0
 

Author Closing Comment

by:SparkyP
Comment Utility
Thanks for the explanations. Works just as I wanted it. Really appreciate your patience.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now