Expressions

E

Emma

Hi I have a textbox on a form that calculates a sum of Income Amounts and is
working correctly. Unfortunately when I go the the table the value is not
saved in the table. Here's the formula
=[ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[ApplicantIncomeAmount3]+[CoApplicantIncomeAmount1]+[CoApplicantIncomeAmount2]+[CoApplicantIncomeAmount3].
I would like the table value TotalIncome to be this value. I know it's a
logic problem on my part, how do I do this?
 
G

GBA

this is a calculated value made by your textbox which is unbound. and
the db advice one will always recieve is that there is no reason to store
calculated values - as long as you will always have the underlying elements
that make the calculation.

so as currently designed - it is a correct design.

in situations where calculations are made by the db - for the ease of the
human experience - but where the final calculated value must also be stored
for valid management/legal reasons; you must have that field in your
underlying table. You can not use an unbound text box. The calculation
formula can not be defined inside the textbox; it would be placed to occur
generally in the 'AfterUpdate' event of one of the other input fields. i.e.
me.totalFinal = [ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[etc.

hope this helps...
 
E

Emma

I tried adding the following to the after update for TotalNetIncome:
Private Sub TotalNetIncome_AfterUpdate()
TotalNetIncome = [ApplicantIncomeAmount1] + [ApplicantIncomeAmount2] +
[ApplicantIncomeAmount3] + [CoApplicantIncomeAmount1] +
[CoApplicantIncomeAmount2] + [CoApplicantIncomeAmount3]
End Sub

but it's still not working, what am I doing wrong? I seem to remember I had
to change something in the form record source which is pointing at a query
right now.

GBA said:
this is a calculated value made by your textbox which is unbound. and
the db advice one will always recieve is that there is no reason to store
calculated values - as long as you will always have the underlying elements
that make the calculation.

so as currently designed - it is a correct design.

in situations where calculations are made by the db - for the ease of the
human experience - but where the final calculated value must also be stored
for valid management/legal reasons; you must have that field in your
underlying table. You can not use an unbound text box. The calculation
formula can not be defined inside the textbox; it would be placed to occur
generally in the 'AfterUpdate' event of one of the other input fields. i.e.
me.totalFinal = [ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[etc.

hope this helps...

Emma said:
Hi I have a textbox on a form that calculates a sum of Income Amounts and is
working correctly. Unfortunately when I go the the table the value is not
saved in the table. Here's the formula
=[ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[ApplicantIncomeAmount3]+[CoApplicantIncomeAmount1]+[CoApplicantIncomeAmount2]+[CoApplicantIncomeAmount3].
I would like the table value TotalIncome to be this value. I know it's a
logic problem on my part, how do I do this?
 
E

Emma

Hi,

Secondly, how do I make it so that the user doesn't have to enter all the
fields for the calculation to work?

GBA said:
this is a calculated value made by your textbox which is unbound. and
the db advice one will always recieve is that there is no reason to store
calculated values - as long as you will always have the underlying elements
that make the calculation.

so as currently designed - it is a correct design.

in situations where calculations are made by the db - for the ease of the
human experience - but where the final calculated value must also be stored
for valid management/legal reasons; you must have that field in your
underlying table. You can not use an unbound text box. The calculation
formula can not be defined inside the textbox; it would be placed to occur
generally in the 'AfterUpdate' event of one of the other input fields. i.e.
me.totalFinal = [ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[etc.

hope this helps...

Emma said:
Hi I have a textbox on a form that calculates a sum of Income Amounts and is
working correctly. Unfortunately when I go the the table the value is not
saved in the table. Here's the formula
=[ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[ApplicantIncomeAmount3]+[CoApplicantIncomeAmount1]+[CoApplicantIncomeAmount2]+[CoApplicantIncomeAmount3].
I would like the table value TotalIncome to be this value. I know it's a
logic problem on my part, how do I do this?
 
G

GBA

the total field must exist in the underlying table; and if the form is
sourced from a query - then that field must be included in that query too - -
so that ultimately the field appears in the form's field list in order to be
added to the form itself.

to make the calculation after any sub element is completed - you would need
to put that calculation code into each sub fields AfterUpdate Event.



Emma said:
Hi,

Secondly, how do I make it so that the user doesn't have to enter all the
fields for the calculation to work?

GBA said:
this is a calculated value made by your textbox which is unbound. and
the db advice one will always recieve is that there is no reason to store
calculated values - as long as you will always have the underlying elements
that make the calculation.

so as currently designed - it is a correct design.

in situations where calculations are made by the db - for the ease of the
human experience - but where the final calculated value must also be stored
for valid management/legal reasons; you must have that field in your
underlying table. You can not use an unbound text box. The calculation
formula can not be defined inside the textbox; it would be placed to occur
generally in the 'AfterUpdate' event of one of the other input fields. i.e.
me.totalFinal = [ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[etc.

hope this helps...

Emma said:
Hi I have a textbox on a form that calculates a sum of Income Amounts and is
working correctly. Unfortunately when I go the the table the value is not
saved in the table. Here's the formula
=[ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[ApplicantIncomeAmount3]+[CoApplicantIncomeAmount1]+[CoApplicantIncomeAmount2]+[CoApplicantIncomeAmount3].
I would like the table value TotalIncome to be this value. I know it's a
logic problem on my part, how do I do this?
 
J

John W. Vinson

Hi I have a textbox on a form that calculates a sum of Income Amounts and is
working correctly. Unfortunately when I go the the table the value is not
saved in the table. Here's the formula
=[ApplicantIncomeAmount1]+[ApplicantIncomeAmount2]+[ApplicantIncomeAmount3]+[CoApplicantIncomeAmount1]+[CoApplicantIncomeAmount2]+[CoApplicantIncomeAmount3].
I would like the table value TotalIncome to be this value. I know it's a
logic problem on my part, how do I do this?

If you need to keep track of the individual income amounts, your table
structure IS WRONG.

If you try to keep track of the individual amounts and also the sum, it's even
*wronger*.

What will you do when you have an applicant with *four* income streams
(interest, IRA, and two Schedule C businesses)?

If you have a one (applicant) to many (incomes) relationship, model it *as a
one to many relationship* with an Incomes table related one to many to your
applicants table. A Totals query will let you sum the incomes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top