How To Recalculate All Records (1 Viewer)

vdanelia

Registered User.
Local time
Today, 03:31
Joined
Jan 29, 2011
Messages
215
Hello Mates!
I Made a command button to recalculate the field values (For Emergency if somewhere accidentally was left not calculated)
here is My Code:
Me.Sumall = Me.Quantity * Me.Unitprice

It works only the current record (Which I See on the form)

My task was: To search the given field values and if there was not calculated then to be recalculated that field values (With Given Criteria)

Thanks In Advanced
 

vbaInet

AWF VIP
Local time
Today, 10:31
Joined
Jan 22, 2010
Messages
26,374
Why don't you put it in the Control Source?

=[Quantity] * [Unitprice]
 

vdanelia

Registered User.
Local time
Today, 03:31
Joined
Jan 29, 2011
Messages
215
Hi vbaInet
Because It only displays the result (I know it is Good and simple, I'm using that in other access projects) and not storing in the database (Frequently I exporting the data for users in excel and that value is very important)
 

vbaInet

AWF VIP
Local time
Today, 10:31
Joined
Jan 22, 2010
Messages
26,374
I don't understand what you mean by "it displays the result". In what event did you put your original code?
 

vdanelia

Registered User.
Local time
Today, 03:31
Joined
Jan 29, 2011
Messages
215
I meant that the SumAll result is not stored in table
I have a table with fields (there are other fields too but I'm focusing only them)
Unitprice - A unit price of the product (RecordSource Unitprice)
Quantity - Quantity is automatically counted (It is not so important)
SumAll - gives a total sum of the products (Record source SumAll) Here On Enter I use that vba code. but my problem was sometimes when I enter the data On Unitprice then i have to click on SumAll to give me the calculation. I want to avoid this
 

vdanelia

Registered User.
Local time
Today, 03:31
Joined
Jan 29, 2011
Messages
215
Sometimes I have to export the table to Excel for other persons, and the SumAll calculation must be there
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 21:31
Joined
Jan 20, 2009
Messages
12,849
No need to store the value. Queries can be exported.
 

vbaInet

AWF VIP
Local time
Today, 10:31
Joined
Jan 22, 2010
Messages
26,374
So like GalaxiomAtHome mentioned, you can export queries. Move the calculation to a query and export the query. If you want a total sum at the bottom, create a report, sum at the report footer and export the report.
 

vbaInet

AWF VIP
Local time
Today, 10:31
Joined
Jan 22, 2010
Messages
26,374
Good to know that you took on board what you were adviced.

Good luck with the rest of your project.
 

Users who are viewing this thread

Top Bottom