Recalculating Subform

F

FrankTimJr

I'm having trouble getting a subform to recalculate

"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".

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.
 
G

Guest

In the AfterUpdate event of the Status textbox that tiggers the change try
using this code:

Forms!frm_Order_Wksheet!frm_Q1_Summary .requery
 
F

FrankTimJr

Ok, I'm getting somewhere, but it's not 100% yet.

When I use that code, it recalculates the subform's "form footer" only and
not the subform's "detail" section. I still have to manually press the F9
key to change the values in the detail section.
 
G

Guest

Two lines then:

Forms!frm_Order_Wksheet!tab_Rev_Summary.requery
Forms!frm_Order_Wksheet!frm_Q1_Summary.requery
 
F

FrankTimJr

I got it!!! I used both lines of code you suggested, but it still wansn't
working.

So I added DoCmd.RunCommand acCmdSaveRecord and now it works exactly the way
I wanted!

Thank you so much!!!!
 

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

Similar Threads


Top