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

How to a requery a datasheet on a tab?

Status
Not open for further replies.

philliplaw

IS-IT--Management
May 4, 2011
6
US
I have some navigation tabs in a sub-form. Each tab shows information in a datasheet. The first column of each data sheet is setup like a hyperlink with an "on click" event.

Example: The "Purchase Order" tab list all the purchase orders, supplier, order date, etc. If you click on the purchase order number, a form is launched displaying all the purchase order details. When the details are updated on the new form and closed, the information does not automatically update on the original datasheet (tab). If I click on a different tab and then come back, the information is correct. How can I requery/refresh a tab.

Thank you
Phillip
 
Maybe you need something like this...

Datasheetcontrol.Requery
Form.refresh

I'd play around with the different items if one or one combo doesn't work.... refresh, requery, or re...something, I forget the other, but if you hit the dot, and type re, you'll see the options. [wink]
 
How are ya philliplaw . . .

Copy/paste the following support routine to a module in the modules window:
Code:
[blue]Function IsOpenForm(frmName As String) As Boolean
   
   If CurrentProject.AllForms(frmName).IsLoaded Then
      [green]'if form is loaded and not in design view, then ok![/green]
      If Forms(frmName).CurrentView > 0 Then IsOpenForm = True
   End If
   
End Function[/blue]
Then in the [blue]On Close[/blue] event of the form thats opened when you click on the purchase order number, copy/paste the following (note:[blue]you![/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   If IsOpenForm("[purple][b]YourFormName[/b][/purple]") Then
      Forms![[purple][b]YourFormName[/b][/purple]]![[purple][b]subFormName[/b][/purple]].Form.Requery
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Sorry guys, I got side tracked. After hours of dorking around with this, the solution was:


Forms![MainFormName].[NavigationSubform].Form.Requery

NavigationSubform is not the subform name. it is the control name of the navigation subform (found on the "Other" tab - Name field).

Phillip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top