Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Refresh Combo Box on Subform

Posted on 2013-01-21
4
Medium Priority
?
510 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
[X]
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
  • 2
  • 2
4 Comments
 
LVL 85
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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

721 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