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!

requerying multiple tabs (and their subforms) on a main form 1

Status
Not open for further replies.

Krykota

Technical User
Jun 28, 2010
12
US
My db is designed to track work orders. I have a data entry tab, a current tab, a past due tab, and a completed tab.

What I hope to accomplish is to mark a work order complete and then have all the forms in all tabbed pages requery. Hence, the work order marked complete disappears from the current tab (for example) and when the user clicks on the completed tab, it is there.

I have used Forms![WorkOrder].requery to refresh the information on the data entry page, but I am unable to use the same code to refresh the data on the other pages.

There are threads I have found that pass data to other tabbed pages, but nothing that works for my app.

The solution seems easy enough, just can't seem to find the way to make it happen.

Thanks for any input.

K
 
The generic syntax is:
Forms![name of mainform]![name of control hosting the subform].Form.Requery

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, thanks for the suggestion.

I tried that and could not get Access to locate the control.

Forms![WorkOrder]![TabCtl4].Form.Requery

A google search yielded this suggestion.

DoCmd.RunCommand acCmdSaveRecord
Me.Requery

Access did not like it (unless I have it in the wrong spot). Hold on a second. Nope didn't work on a Change event.

What are thoughts and methods to requery a tab page when you click on the tab? Would that be a Got Focus event?
 
Replace TabCtl4 with the name of the control hosting the subform in this tab.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I think that is where I am stuck.

The design of the whole form.

frmWorkOrder
TabCtl4
Page 5(Data Entry), Page 6 (Current Work Order), (etc)

Page 6 (where my action takes place and repeatable for the other tabs on the form)
frmWorkOrderMain
frmWorkOrderList (a query based list of work orders)
frmWorkOrderCurrent (has a button that when clicked, marks the work order complete, sets the date of completion ... and where I desire to trigger the update of the work order to the "Completed" tab.

I would like to repeat this (requery the data for all tabs) for the other tabs which have near identical forms (save where current, past due, or complete).
 
A starting point:
Code:
For Each c1 In Forms![WorkOrder].Controls
  If c1.ControlType = acSubform Then
    c1.Form.Requery
    For Each c2 In c1.Controls
      If c2.ControlType = acSubform Then
        c2.Form.Requery
      End If
    Next
  End If
Next

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
... and the finishing point!!!

More complicated than I first envisioned but it does exactly what I needed.

I went through about 25 articles listed on google on this question and none provided the solution.

Sincerely and robustly,

THANK YOU!!!!!

p.s. just how many stars can I give you for this???? :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top