Refresh certain txtboxes on a page with Form referenes

  • Thread starter Thread starter Mr. Smith
  • Start date Start date
M

Mr. Smith

Hi.

(Access 03)

I have a form with a page object. The page object has some 8 pages. Each
page has a sub form. I've linked some of the textboxes on the first page to
be able to have consolidated information as the first of the 8 pages.



A text box in a sub form on the first page has a reference like this, to a
text box in the sub form on page 2.



=Forms!sub_frm_revenue_pg2!txt_totalrevenue_a



txt_totalrevenue_a in the subform in page 2 control source =
txt_revelement_a1 + txt_revelement a2 .....a10



Problem is when the txt_totalrevenue_a changes, it is not "inherited" to the
reference text box on page 1 unless the entire sub form on page 1 one is
reloaded.



As the sub form on page 1 is quite heavy I should like to update only some
of the text boxes, trigged by a kind of "isdirty" mode from underlying
pages.



Psaudo

When a revenue element in page 2 is changed and the txt_totalrevenue_a is
changed

Update all references to txt_totalrevenue_a on page 2......



Sorry for the messy explanation. Think kind of same as references between
cells in different Excel sheet.....



Any hints appreciated



Kind regards

Mr. Smith
 
Hello Mr. Smith

I assume you mean a "tab control", not a "page object"?

First, does the subform on page 1 need to be a subform? It would be simpler
just to place the textboxes for the consolidated information directly onto
the tab control page. Then the control source for your textbox does not
need to reference the Forms collection:
=sub_frm_revenue_pg2!txt_totalrevenue_a

Secondly, it occurs to me that page 1 is invisible while you are updating
the subforms on the other pages, so you really only need to refresh the
content of page 1 when that page is selected. For this you can use the tab
control's Change event:

Private Sub tbcPages_Change()
If tbcPages = 0 Then
<refresh the subform/textboxes as necessary>
End If
End Sub

To refresh the textbox, or an entire subform, use the Refresh method:

txt_totalRevenue_pg2.Requery
or
sub_frm_pg1.Requery
 
Thanks Graham

Nice approaches (and yes, it's a "tab control")



What I did was to use the "tag" properties on the text boxes I needed to
update, I've used tag arrays with success previously.



My text boxes has tag values as arrays in this way a|r|...|...|...



a = all users can view this text boxes

r = requery this text box when Tab_change occurs



Tanks for your time Graham.



Kind regards

Mr. Smith




Graham Mandeno said:
Hello Mr. Smith

I assume you mean a "tab control", not a "page object"?

First, does the subform on page 1 need to be a subform? It would be
simpler just to place the textboxes for the consolidated information
directly onto the tab control page. Then the control source for your
textbox does not need to reference the Forms collection:
=sub_frm_revenue_pg2!txt_totalrevenue_a

Secondly, it occurs to me that page 1 is invisible while you are updating
the subforms on the other pages, so you really only need to refresh the
content of page 1 when that page is selected. For this you can use the
tab control's Change event:

Private Sub tbcPages_Change()
If tbcPages = 0 Then
<refresh the subform/textboxes as necessary>
End If
End Sub

To refresh the textbox, or an entire subform, use the Refresh method:

txt_totalRevenue_pg2.Requery
or
sub_frm_pg1.Requery

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Mr. Smith said:
Hi.

(Access 03)

I have a form with a page object. The page object has some 8 pages. Each
page has a sub form. I've linked some of the textboxes on the first page
to be able to have consolidated information as the first of the 8 pages.



A text box in a sub form on the first page has a reference like this, to
a text box in the sub form on page 2.



=Forms!sub_frm_revenue_pg2!txt_totalrevenue_a



txt_totalrevenue_a in the subform in page 2 control source =
txt_revelement_a1 + txt_revelement a2 .....a10



Problem is when the txt_totalrevenue_a changes, it is not "inherited" to
the reference text box on page 1 unless the entire sub form on page 1 one
is reloaded.



As the sub form on page 1 is quite heavy I should like to update only
some of the text boxes, trigged by a kind of "isdirty" mode from
underlying pages.



Psaudo

When a revenue element in page 2 is changed and the txt_totalrevenue_a is
changed

Update all references to txt_totalrevenue_a on page 2......



Sorry for the messy explanation. Think kind of same as references between
cells in different Excel sheet.....



Any hints appreciated



Kind regards

Mr. Smith
 
Back
Top