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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh subform on tab control from another subform 1

Status
Not open for further replies.

beansmom

Programmer
Aug 24, 2004
35
US
I have a form with a tab control. I have a number of pages, each with one subform. On subform1 I have a button that when clicked runs a query and populates the form. It also runs a query that populates subform2 on another page. It then requeries subform1, so the users can see the information. My problem is that I cannot get subform2 to refresh, so the users can see the information when they click on the page. I have have to hit the F9 to see the information. Here is my code:

Dim stDocName As String
Dim stDocName2 As String

stDocName = "APPEND Lab-Eval"
stDocName2 = "APPEND Diag-Eval"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
DoCmd.Requery
DoCmd.SetWarnings True

Thanks for your assistance!
 
Why dont you try requering the subforms independently. Something like:

Me.requery
Me!Parent!subform2.requery

Hope you find this useful

Percy
 
When I try this I get an error that says can't find the field PtInfo.

stDocName = "APPEND Lab-Eval"
stDocName2 = "APPEND Diag-Eval"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
DoCmd.Requery
Me![frmPtInfo]![frmDiagnostics].Requery
DoCmd.SetWarnings True
 
I think your problem is on the last but 1 line

Replace it with this:

Code:
Forms!frmPtInfo!frmDiagnostics.Requery

Hope u find this useful

Percy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top