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

Data in a tab control subform will not refresh with Requery 1

Status
Not open for further replies.

Johnnycat1

Programmer
May 4, 2005
71
US
I have form with a multi-page tab control on it.

All of the tabs/pages have data-sheet subforms on them.

Data on the data-sheet on the 2nd tab is a product of selections made in the data-sheet on the 1st tab.

After the user makes the selections on the 1st tab, the database runs an append query that creates the data for the data-sheet on the 2nd tab.

The problem that I have is that the data-sheet on the 2nd tab will not refresh without adding a button on the form with the following code:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

The code to run the append query to populate the data-sheet on the second tab is in the "On Click" event on the second tab.

This is the code that I use to run the append query.

Private Sub Product_Pricing_Click()

DoCmd.Echo False, ""
DoCmd.SetWarnings False
DoCmd.OpenQuery "QryBidPricingAppend", acViewNormal, acEdit
DoCmd.Echo True, ""

Me.Requery

' DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

' DoCmd.Requery Forms!BidDetail!QryBidPricingSubform
' DoCmd.Requery Forms!BidDetail!bidProductPricingSubForm


End Sub

As you can see, I have tried to requery to refresh the data on the subform but none of the methods that I use will refresh the data.

As always, I am very grateful that there are people that are much smarter than me out there. Thanks for any help that you can provide.
 
How are ya Johnnycat1 . . .

Try:
Code:
[blue]Me.Parent.SubformName.Form.Requery[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Aceman,

Good to see that you are still active... You have given me some great help in the past.

I used the code that you sent me in the On-Click event but still nothing. Could it be that when you click from one tab to another that because focus never leaves the tab control, it is not requerying the data-sheet subform?

I am just playing on hunches and guessing at this point.
 
Johnnycat1

My Bad! . . . Just gotta get it right. Try this:
Code:
[blue]   Me![purple][b]TabControlName[/b][/purple].Parent.SubformName.Form.Requery[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Me!TabControlName.Parent.SubformName.Form.Requery"

This is definitely incorrect. You do NOT need to reference the tab control. The first code WAS correct:

Me.Parent.SubformCONTAINERName.Form.Requery

Make sure to use the subform container (control that houses the subform on the main form) name. Because the other didn't work I would assume that it was possible that the subform name and the subform container are not named the same an johnnycat1 used the subform name instead of the subform container.


Bob Larson
A2K,A2K3,A2K7,SQL Server 2000/2005,Crystal Reports 10/XI,VB6, WinXP, and Vista
Free Quick Tutorials and Samples:
 
Johnnycat1 . . .

While testing a Db it hit me!
TheAceMan1 said:
[blue]The real problem is with the event used. The On Click event of a page fires when you click on a page . . . [purple]not the tab![/purple] Further, this means [purple]clicking on a blank area of the page![/purple] If you click on a control or subform on the page, no trigger! . . .[/blue]
So delete the page [blue]On Click[/blue] event, and in the tab controls [blue]On Change[/blue] event, try the simple:
Code:
[blue]  If Me!TabControlName = 1 Then Forms!MainformName!SubformName.Form.Requery[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hit submitt too soon . . . [blue]Page index starts at zero![/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Aceman... You did it again!

Thanks again for sharing your expertise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top