Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Refresh Combo Box on Subform

Posted on 2013-01-21
4
480 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
ID: 38801731
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
ID: 38802210
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
ID: 38802981
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
ID: 38803073
Thanks for the explanations. Works just as I wanted it. Really appreciate your patience.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

838 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