Refresh Not Working on subform

  • Thread starter Thread starter FrankTimJr
  • Start date Start date
F

FrankTimJr

I am getting a little frustrated because I can't seem to get the "Refresh"
command to work at all. I am probably doing something wrong, but here is
what is happening.

My main form "frm_Register" contains two subforms. One, called
"frm_Order_Wksheet" is used to identify if an order will be completed in a
specific month. The user would select from a dropdown called "Status" one
of a few values. "Committed", "Risk", "New" and a couple of others. This
subform is where all of the editing is done. The second subform is called
"frm_Revenue_Summary" where it calculates all of the revenue in the specific
'buckets' from the "Status" field on the "frm_Order_Wksheet". Think of
"frm_Revenue_Summary" as sort of a calculator that tells the user how much
revenue they committed to.

If I choose a "Status", then click on the subform "frm_Revenue_Summary",
then either press the F9 key or go to Records => Refresh, the values are
updated appropriately.

Accoring to the Visual Basic Help within Access, all I needed to do is use
an OnActivate event "Me.Refresh" in "frm_Revenue_Summary". So what I did
was the following:

When I pick a "Status", I created an "AfterUpdate" event: DoCmd.GoToControl
"frm_Revenue_Summary". Then, in the OnActivate event in
"frm_Revenue_Summary", I created an OnActivate event: Me.Refresh.

It is not working at all. But if I remove the OnActivate event, but leave
the AfterUpdate event on "Status" within the subform "frm_Order_WkSheet",
then I test it by selecting "Commited" on one of the orders, I press F9 key
and it refrehses perfectly.

What am I doing wrong? Or, what else could I do to make this work more
efficiently w/out having to use a TON of code.
 
When you ask the 'gotocontrol' command in the sub-form it searches
within the subform for the control you are referrring.
tray docmd.gotocontrol me.parent.frm_Revenue_Summary
and then refresh or put the following line in the subform:
me.parent.frm_Revenue_Summary.refresh

hope it helps
 
Unfortunately that did not work either.

There is no 'relationship' between "frm_Revenue_Summary" and
"frm_Order_Wksheet". The data is related, ("frm_Revenue_Summary" is a sum
of the data within "frm_Order_Wksheet") but the main form called
"frm_Register" is not lined to any table or query. It's just a blank form
with the two subforms within, so I'm not sure what you mean when you refer
to "PARENT".
 
Is there anyone else who can help me? The one suggestion did not work.

I'll try and explain it a little differently:

"frm_Order_Wksheet" is in datasheet format and shows all open orders
"frm_Q1_Summary" is a summary of the different status retrieved from
"frm_Order_Wksheet"

I could use a list box, but then I lose the ability to create additional
controls.

When the "Status" field within frm_Order_Wksheet is changed, I want
frm_Q1_Summary to automatically update with the new totals. The
"frm_Q1_Summary" subform is part of a tab control. There is one subform for
each quarter in the year, so there are four tabs, one for each quarter. I
named the tab control "tab_Rev_Summary". I didn't think that made a
difference which is why I didn't disclose that in the original message.

The code is within the AfterUpdate event on the Status field within
"frm_Order_Wksheet" and I've tried using
Me.Refresh

Me.Requery

DoCmd.GoToControl "tab_Rev_Summary"
Me.Refresh (also Me.Requery)

DoCmd.GoToControl "frm_Q1_Summary"
Me.Refresh (also Me.Requery)

None of the above worked. I even tried creating a button called
"recalculate", but then I get a message saying "refresh isn't available".

If this cannot work, I can just instruct the user to press the F9 key to
refresh the totals since that does work. I just can't seem to automate it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top