PC Review


Reply
Thread Tools Rate Thread

Automatically recalculate a sum field

 
 
=?Utf-8?B?bWdrYWFt?=
Guest
Posts: n/a
 
      25th Jan 2007
I have fields for mon, tue, wed, etc. I have a text box at the end that
calculates the running total of these fields. How do I get this field to
update it's total if someone changes the total say on wednesday without
having to press the F9 key?

Thanks in advance!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?=
Guest
Posts: n/a
 
      25th Jan 2007
Hi mgkaam,

You can create the following function in the form's code module:

Option Compare Database
Option Explicit

Function RefreshTotal()
On Error GoTo ProcError

Me.txtNameOfControl.Requery

ExitProc:
Exit Function
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure RefreshTotal..."
Resume ExitProc
End Function


To call this function, place the following in the After Update event
procedure, shown in the Properties tab for each of the text boxes Monday,
Tuesday, Wednesday, etc.:

=RefreshTotal()


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

"mgkaam" wrote:

> I have fields for mon, tue, wed, etc. I have a text box at the end that
> calculates the running total of these fields. How do I get this field to
> update it's total if someone changes the total say on wednesday without
> having to press the F9 key?
>
> Thanks in advance!

 
Reply With Quote
 
=?Utf-8?B?bWdrYWFt?=
Guest
Posts: n/a
 
      25th Jan 2007
Thanks for the answer! Is there a easier way of just having my unbound total
field just change it's total when say thursday's amount is entered after
having mon, tues weds total in there, basically a current running total
field? Just trying to keep this simple.

Thanks again!

"Tom Wickerath" wrote:

> Hi mgkaam,
>
> You can create the following function in the form's code module:
>
> Option Compare Database
> Option Explicit
>
> Function RefreshTotal()
> On Error GoTo ProcError
>
> Me.txtNameOfControl.Requery
>
> ExitProc:
> Exit Function
> ProcError:
> MsgBox "Error " & Err.Number & ": " & Err.Description, _
> vbCritical, "Error in procedure RefreshTotal..."
> Resume ExitProc
> End Function
>
>
> To call this function, place the following in the After Update event
> procedure, shown in the Properties tab for each of the text boxes Monday,
> Tuesday, Wednesday, etc.:
>
> =RefreshTotal()
>
>
> Tom Wickerath
> Microsoft Access MVP
>
> http://www.access.qbuilt.com/html/ex...tributors.html
> http://www.access.qbuilt.com/html/search.html
> __________________________________________
>
> "mgkaam" wrote:
>
> > I have fields for mon, tue, wed, etc. I have a text box at the end that
> > calculates the running total of these fields. How do I get this field to
> > update it's total if someone changes the total say on wednesday without
> > having to press the F9 key?
> >
> > Thanks in advance!

 
Reply With Quote
 
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?=
Guest
Posts: n/a
 
      25th Jan 2007
Honestly, I thought what I gave you *is* pretty easy.
But I suppose pressing the F9 button is easier if you are code aversive.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

"mgkaam" wrote:

> Thanks for the answer! Is there a easier way of just having my unbound total
> field just change it's total when say thursday's amount is entered after
> having mon, tues weds total in there, basically a current running total
> field? Just trying to keep this simple.
>
> Thanks again!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
recalculate a score for old records in a new field Andreas Microsoft Access 3 13th Jan 2009 11:47 PM
Adding a column and recalculate formula automatically BACH Microsoft Excel Misc 4 29th Oct 2008 08:47 PM
Forcing field to recalculate John Microsoft Access 1 14th Nov 2007 07:53 AM
Recalculate Formula when field value changes patilprt Microsoft Excel Misc 1 18th Jul 2006 10:29 PM
Can you make excel automatically recalculate every x seconds? =?Utf-8?B?QURX?= Microsoft Excel Misc 0 17th Feb 2005 11:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:23 PM.