Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-25-2019, 02:02 AM   #1
Ravi Kumar
Newly Registered User
 
Join Date: Aug 2019
Posts: 86
Thanks: 106
Thanked 0 Times in 0 Posts
Ravi Kumar is on a distinguished road
Automatic totals

hello all,
I have a form called usage of gauges,
In it i will enter the number of times i have used the gauge today ,
but this must be added to the table named same as my form & store the new value.
for example: if in my form i enter position = 36,
suppose the column field contained 24 earlier in my table, it should save with 60 now .
how to achieve this??

Ravi Kumar is offline   Reply With Quote
Old 09-25-2019, 07:50 AM   #2
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,247
Thanks: 13
Thanked 4,102 Times in 4,034 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Automatic totals

As a general rule most of us would not try to maintain the total value. We would store the transactions (24 and 36 in your example) and simply sum them with a query or DSum() as needed for forms/reports.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
The Following User Says Thank You to pbaldy For This Useful Post:
Ravi Kumar (09-25-2019)
Old 09-25-2019, 02:32 PM   #3
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 28,238
Thanks: 15
Thanked 1,591 Times in 1,511 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Automatic totals

I agree 100% with Paul. There is no way to audit a table where you can just increment the values. It is far superior to add these two as separate transactions and then sum the transactions.

However, we are looking at this request out of context and for all we know, you are trying to make a calculator. If that is the case, you would have the bound column which shows the existing value and the result after update and an unbound column in which you enter the value you want to "add" to the existing value. Then either in the AfterUpdate event of the unbound control or in the BeforeUpdate event of the form, you would add the two fields and the result gets placed in the bound field

Nz(Me.yourboundcontrol,0) + Nz(Me.yourunboundcontrol, 0)

You need the Nz() function just in case either column is null in order to avoid an arithmetic error.

__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
The Following User Says Thank You to Pat Hartman For This Useful Post:
Ravi Kumar (09-25-2019)
Reply

Tags
automated data entry , form

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Totals Query/sums/grand totals thsoundman Queries 17 04-16-2013 11:24 AM
Displaying previous totals, and current totals, on a report Janzi Queries 0 12-05-2011 11:17 AM
Dynamic Report - Preview Totals differ from Printed Totals Longworth2 Reports 5 06-16-2009 01:18 PM
Automatic Totals on Report sweetie Reports 2 12-29-2005 09:25 AM
[SOLVED] Totals in Report returns totals for all records dcg2122 Reports 1 11-09-2003 03:52 PM




All times are GMT -8. The time now is 01:36 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World