Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

update mainform from subform calculation

Posted on 2003-12-01
14
Medium Priority
?
576 Views
Last Modified: 2010-08-05
I have a main form which pulls a Sum'd calculation NetAmt from the footer of the subform; however ... the NetAmt on the mainform seems to update before the NetAmt on the subform ... so the mainform is always one step behind.

Literally, when I leave the subform, I see the mainform's NetAmt update ... and then 1/2 second later the NetAmt on the subform update ... making the mainform one step behind.
0
Comment
Question by:tljprincess
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
14 Comments
 
LVL 10

Expert Comment

by:jobrienct
ID: 9855943
Hi tj,

perhaps in your subforms control, in the after update event, add Me.Parent.Refresh

see if that helps

John
0
 

Author Comment

by:tljprincess
ID: 9855989
nope, that didn't work ... the subform is continuous forms and when i did that, it made the previous record disappear on the subform (although it was saving those individual records ... the NetAmt didn't ever show any value)
0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9856034
can you send your database? check my profile for the email address if you can.

John
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tljprincess
ID: 9856094
i really can't ... confidentiality .. however, i can give you more details

the main form is a treatment form (for a Dr.) ... the subform lists all the specific treatment types, cost, qty .... then the subtotal of the subform's Costs (Net Amt) is pulled to the mainform and called the BalanceDue.  I do this with a Sum field in the footer of the subform and then I pull that field to the mainform with the formula =[TRdetail subform].Form!TRsubformSubtotal

i have created a test button that does the docmd.repaintobject on the mainform and if i hit that button twice, it finally is right ... however, even if i put in the docmd.repaintobject twice on the one button (instead of hitting it twice) ... that doesn't work either.  
0
 
LVL 10

Accepted Solution

by:
jobrienct earned 1000 total points
ID: 9856146
interesting problem. can you possibly copy the database, empty the copy of confidential information and enter just enough bogus data to show me the problem and send that?

Im sure I could figure it out if I was looking at it. If you can't then tell me what event of what control on the subform you use to update the main form. Or am i reading right that you are updating the main forms Balance due from the main form?

If thats the case I think you may need to reverse the process. in the subforms control where you store the sum, in its after update event try Me.Parent.txtBalandue.value = mySumControlname.value (is that TRsubformSubtotal?)

John
0
 
LVL 32

Expert Comment

by:jadedata
ID: 9856176
Hey tljprincess!

  One way to slay a beast like this is to write a function that is called by the appropriate AfterUpdate or Current (or other) events to keep the calculated fields sync'd on the form.

  The subform can call such a function with a name like Form_RecalculateAll() on the main form:
   me.parent.Form_RecalculateAll

  This function could FORCE the recalc/refresh/repaint of all of the controls on the form at once, IN THE ORDER you specify.

regards
Jack
0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9856198
jade if her control is in the footer of a subform, .Parent still refers to the main form right?

John
0
 

Author Comment

by:tljprincess
ID: 9856223
John, wonderful ... simple answer.  Thank you!
0
 

Author Comment

by:tljprincess
ID: 9856237
WAIT! John ... hold on ... I tested it with multiple records in the subform and it didn't work ... ahhh!  It is as if I need to save that last record in the subform ... so the AfterUpdate isn't running on that last record because it isn't saved.  
0
 

Author Comment

by:tljprincess
ID: 9856289
ok ... it is too late ... retract that last statement and revert back to the previous

John ... great job and thank you.
0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9856350
huh wha who? retract what, revert to what? im lost, is it working? :)

John
0
 

Author Comment

by:tljprincess
ID: 9915782
all is working ... sorry for the confusion ... how do you suggest i do the point?
0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9915960
tj,

You need to assign points according to the help you received. for instance in this question you have myself and jadedata assisting you, if one of us helped you and the other did not then you can simply choose the helpful answer and assign the points there. if both answers were helpful you should split the points, accepting the most helpful answer and assigning points to the assisting answer approriately. Its really completely up to you, but you need to do it thoughtfully. Its monopoly money, but it's your monopoly money :)

In this case you have already assigned the points to my question by accepting it, I can however remedy it by splitting those points with JD myself, otherwise to make a change would require administrative intervention, and they're busy guys :)

JD I'll post points in the main forum for you referencing this question.

regards,

John
0
 

Author Comment

by:tljprincess
ID: 9916878
i think it is appropriate the way I did it ... thanks so much!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question