Page 1 of 1

[Solved] Calculation based on results of 2 other fields

PostPosted: Mon Sep 10, 2018 2:50 pm
by Maax555
Hi, I have a form which requires a simple calculation to be shown on the form (used to quickly estimate a value).
So the used will input a number in field A, field B will be a result of the field chosen from a ListBox and field C will be (A * B).
The form does not need to store the result as it is only an estimate. The user can then choose to use the estimate by entering this manually in another field which will be stored. I was thinking that a Viewtable from a query may be the way ahead but despite searching the forum nothing has helped.
Is there a way on performing a simple calculation as mentioned above? I will also be looking to use other calculations as I progress which should be along the same lines as this.

many thanks

Re: Calculation based on results of 2 other fields in form

PostPosted: Mon Sep 10, 2018 4:01 pm
by Villeroy
Form source type: SQL or Query
Source: SELECT *, "A" * "B" AS "AxB" FROM "Table" (or the name of the query with this SQL)

Re: Calculation based on results of 2 other fields in form

PostPosted: Tue Sep 11, 2018 4:14 pm
by Maax555
Villeroy wrote:Form source type: SQL or Query
Source: SELECT *, "A" * "B" AS "AxB" FROM "Table" (or the name of the query with this SQL)


OK, so i can get a query to calculate the desired result. Cant get the result to show in the form yet, but still trying.

Thanks Villeroy, very helpful as always :-)

Re: Calculation based on results of 2 other fields in form

PostPosted: Tue Sep 11, 2018 4:28 pm
by Villeroy
Add any type of text box or numeric control to the form. Linked field = AxB

Re: Calculation based on results of 2 other fields in form

PostPosted: Wed Sep 12, 2018 12:08 pm
by Maax555
Villeroy wrote:Add any type of text box or numeric control to the form. Linked field = AxB

Yes, believe i tried this unsuccessfully. I added the field to a subform, changed subform to Query with content coming from the Q_LabourEst.
I then had the data field linked to the relevant result field in the query.
As is apparent I am no expert but believe this should work so probably have an issue somewhere else.
This is on the same form where i am trying to modify without creating a duplicate. I will concentrate on that one as i think I can get this working.
(thanks to your help).

thank you.

Re: Calculation based on results of 2 other fields in form

PostPosted: Wed Sep 12, 2018 12:13 pm
by Maax555
Ah ok, this is kind of working if i click in the actual calculation field and advance through the records it changes accordingly.
However the rest of the data on the form is not changing, which is to do with another issue I have.

thanks again.