Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery Subform from a Continuous Sub Form

Status
Not open for further replies.

vanessa03

Technical User
May 13, 2003
110
US
Access 2003- I have 3 forms:
Main Form- frmProductionForecast
SubForm 1- fsubProductionForecast
SubForm 2- fsubProductionForecastPivotTable

I am trying to requery the subform 2 after updating a field on subform 1(they both use the same table), but to no avail. I can put the code in a command button and it works fine, but I would rather it automatically requery the form once you update the data on form 1. This is the code I have in the After Update event on subform 1.

Private Sub ForecastLbs_AfterUpdate()
Forms!frmProductionForecast.Form!fsubProductionForecastPivotTable.Form.Requery
End Sub
I am not getting any errors, but it is not refreshing the data on Subform 2

Thanks for your help.
 
What about this ?
Code:
Me.Dirty = False
DoEvents
With Forms!frmProductionForecast.Form!fsubProductionForecastPivotTable.Form
  .RecordSource = .RecordSource
End With

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for responding PH. I put that code in subform 1 in the after update event and when I changed the field it just set the subform 2 pivot table to nothing. Just wiped it out. Any other suggestions? Thanks.
 
Got it! I just put the code I had in the lost focus event instead of After Update & it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top