Solved

Refresh Combo Box on Subform

Posted on 2013-01-21
4
471 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

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…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

803 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