Using expression builder to calculate totals inside a form (1 Viewer)

bobunknown

Registered User.
Local time
Today, 12:04
Joined
May 25, 2018
Messages
77
Hi all,

Simple one today, I have a form with financial information in, namely how much a service costs and how many times a year the service is required. To get the total cost I simply multiply the service cost by the service requirement using a function box.

However I have found that the total cost is for some reason not being added to the source table even though there is a field for it? The information is being correctly displayed but nothing else.

Dose anyone have any clue why this is, its really annoying as I was hoping to sue that information to do additional calculations :confused:

Thanks in advance.
 

isladogs

MVP / VIP
Local time
Today, 20:04
Joined
Jan 14, 2017
Messages
18,208
The calculation textbox just displays the calculated value.
If you want to have that in your table you can either use:
1. a calculated field in your table
2. an update query
However BOTH of those are a bad idea for different reasons

Instead use a query with an expression to calculate the total cost as and when required
Your form can then use the query as its recordsource (as can reports) and other calculations can be based on the query
 

bobunknown

Registered User.
Local time
Today, 12:04
Joined
May 25, 2018
Messages
77
Thanks dude :D

1. a calculated field in your table
2. an update query

Just as additional background what's up with using the above? if you don't mind.
 

isladogs

MVP / VIP
Local time
Today, 20:04
Joined
Jan 14, 2017
Messages
18,208
Using either method leads to unnecessary duplication of data
Using an update query also runs the risk that the value won't stay up to date if you modify any underlying data after running the update
 

Users who are viewing this thread

Top Bottom