Calculated field fails to update

ellenr

Registered User.
Local time
Yesterday, 20:03
Joined
Apr 15, 2011
Messages
400
Running Access 2010. My form has two columns that have calculated total (Dsum) fields in the header. If the user presses the Enter key after typing in the value, the total field for that column recalculates properly. If, however, the user simply moves the cursor to another record without pressing the enter key, it doesn't update the total. I have tried doing a "save record and refresh" macro for lost focus, after update, onExit, etc, for the field and none of them will recalculate the total field. Oddly, if the user clicks the little blue button beside the field, it automatically puts 10 in the field followed by refresh, and it recalculates properly. How can I make it refresh without a press of the enter key? As you can see in the attachment, I moved the cursor without hitting enter.
 

Attachments

  • Capture.PNG
    Capture.PNG
    4.1 KB · Views: 110
Could you post your database with some sample data + name of the problem form?
 
...I have tried doing a "save record and refresh" macro for lost focus, after update, onExit, etc, for the field and none of them will recalculate the total field...

A Refresh is done in a Multi-User Environment so that UserA can see changes that have been made to existing Records by UserB, UserC, etc.

If you're trying to make Calculated Fields reflect changes that have been made, you need to execute a Me.Recalc Command.

Linq ;0)>
 
I have attached a skeleton database. Open the Reconciliation form. Clicking yes/no boxes refresh the totals (instantly), clicking the little blue buttons will load $10 in the field and refreshes the form immediately, and pressing enter after entering an amount in one of the charity fields will the totals. I want some way to be sure the totals update if the charity amount is typed in and the user doesn't press the enter key but just moves the cursor to another record. The query immediately reflects the amount, so I know it doesn't fail to save--it just doesn't update the on-screen charity totals. I don't want to requery the entire thing every time a charity amount is entered because it will take too long--the tables for this database are mysql tables connected via odbc. You will see I have experimented with several approaches in the charity cash and check columns.

Thanks for your help.
 

Attachments

I think missinglinq's suggestion does it. Have you tried

Code:
Me.Recalc

in the CCash afterupdate?
 
Use Me.Recalc.
You've also placed the " wrong:
Code:
=DSum([B][COLOR=Red]"[/COLOR][/B]Nz([CharityCheck])[B][COLOR=Red]"[/COLOR][/B];"PlayingQuery")
=DSum([COLOR=Red][B]"[/B][/COLOR]Nz([CharityCash])[B][COLOR=Red]"[/COLOR][/B];"PlayingQuery")
Correct is:
Code:
=DSum(Nz([B][COLOR=Red]"[/COLOR][/B][CharityCheck][B][COLOR=Red]"[/COLOR][/B]);"PlayingQuery")
=DSum(Nz([B][COLOR=Red]"[/COLOR][/B][CharityCash][B][COLOR=Red]"[/COLOR][/B][COLOR=Red][COLOR=Black])[/COLOR][/COLOR];"PlayingQuery")
Database attached:
 

Attachments

Thanks, JHB for the misplaced quotes catch, although it seems to work the other way also. I understand using me.recalc will force the updates. However, it takes several seconds, during which the screen freezes. I am on a gigabit internet connection with a new, fast computer communicating with mysql tables via odbc--can't imagine how frustrating a slow laptop on a slow wifi connection out in the field would be trying to transfer data from check-in sheets. I still don't understand why clicking one of the "Dues" boxes immediately updates not only the dues totals but also the charity columns and clicking one of the little blue dots does an immediate update of the entire form also, all of which refresh instead of requery. Aside from the time involved in the recalc, it returns the cursor to the first page of the form rather than leaving it where it was.
 
Oh, wow! Thank you! I had tried the me.refresh but the change from dsum to sum made all the difference. I can live with that. I am always humbled by the number of folks willing to spend time and effort to help those of us who don't always know what we are doing! You are truly appreciated.
 
You're welcome - good luck. :)
 

Users who are viewing this thread

Back
Top Bottom