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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculated field not updating

Status
Not open for further replies.

parkfairfax

Programmer
May 22, 2001
63
US
Help! I have 2 calculated fields on my form.., they seem very simple.

= Sum([Actual Cost]) and =34000-Sum[[Actual Cost]). These are in the control source line of the properties box.

...Where the first expression totals all by expenses, the 2nd expression subtracts my total expenses from my budget to give me my remaining balance. These 2 text box controls are in my form footer.

The first time I placed these boxes in my footer and defined the calulated fields it worked fine..., all my expenses were totalled, and the new balance was displayed.

But, when I tried to tried to add a new record to my database or change the expenses in any of the existing records the calculated controls did not update.

Can anyone tell me how to fix this and/or why things aren't updating? Thanks ---gm
 
Hi!

You might try using DSum("Actual Cost", "YourTableName") in place of the Sum.

hth Jeff Bridgham
bridgham@purdue.edu
 
If [Actual Cost] is a control you're adding data to when you create the new record, you would have to requery.

On the AfterUpdate event for ActualCost,
Code:
  txtSum.Requery
  txtCost.Requery

Substitute your control names for txtSum and txtCost.


HTH

John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top