Calculating Field values

  • Thread starter Thread starter Beeyen
  • Start date Start date
B

Beeyen

I would like to get a calculation from field1 and field2 to sum in field3.

The coding in Field3 is as follows: =([Field1] / [Field2]) * 30.

But it does not seem to work, can someone tell me what I am doing wrong??
 
Beeyen said:
I would like to get a calculation from field1 and field2 to sum in field3.

The coding in Field3 is as follows: =([Field1] / [Field2]) * 30.

But it does not seem to work, can someone tell me what I am doing wrong??

It doesn't look like a sum to me! That line,

=([Field1] / [Field2]) * 30

should be the record source of text box Field3. Is it?

Tom Lake
 
In addition to what Tom posted, it'll fail whenever Field2 is 0.

You might want to use

=IIf([Field2]=0, 1, ([Field1] / [Field2]) * 30)
 
Thanks you for the quick response and the information. Will field1 fail if it
is 0?
Additionally, How can I have the total in field3 (located in subform1), auto
populate to a field in subform2.

Thanks for the assistance!

Douglas J. Steele said:
In addition to what Tom posted, it'll fail whenever Field2 is 0.

You might want to use

=IIf([Field2]=0, 1, ([Field1] / [Field2]) * 30)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Beeyen said:
I would like to get a calculation from field1 and field2 to sum in field3.

The coding in Field3 is as follows: =([Field1] / [Field2]) * 30.

But it does not seem to work, can someone tell me what I am doing wrong??
 
The reason it'll fail if Field2 is 0 is because you cannot have a
denominator of 0. The value of the numerator doesn't matter.

If you need the calculation in two places, put it in both places.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Beeyen said:
Thanks you for the quick response and the information. Will field1 fail if
it
is 0?
Additionally, How can I have the total in field3 (located in subform1),
auto
populate to a field in subform2.

Thanks for the assistance!

Douglas J. Steele said:
In addition to what Tom posted, it'll fail whenever Field2 is 0.

You might want to use

=IIf([Field2]=0, 1, ([Field1] / [Field2]) * 30)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Beeyen said:
I would like to get a calculation from field1 and field2 to sum in
field3.

The coding in Field3 is as follows: =([Field1] / [Field2]) * 30.

But it does not seem to work, can someone tell me what I am doing
wrong??
 
Thank you Mr Steele,

This is what I have in a field called TestingTotal:
=IIf([TotalScenarios]=0,1,([ScenariosTested]/[TotalScenarios])*30)

Yet, I am now recieving a #Name? as the return. Any ideas what I am still
doing wrong?

Douglas J. Steele said:
The reason it'll fail if Field2 is 0 is because you cannot have a
denominator of 0. The value of the numerator doesn't matter.

If you need the calculation in two places, put it in both places.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Beeyen said:
Thanks you for the quick response and the information. Will field1 fail if
it
is 0?
Additionally, How can I have the total in field3 (located in subform1),
auto
populate to a field in subform2.

Thanks for the assistance!

Douglas J. Steele said:
In addition to what Tom posted, it'll fail whenever Field2 is 0.

You might want to use

=IIf([Field2]=0, 1, ([Field1] / [Field2]) * 30)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I would like to get a calculation from field1 and field2 to sum in
field3.

The coding in Field3 is as follows: =([Field1] / [Field2]) * 30.

But it does not seem to work, can someone tell me what I am doing
wrong??
 
You're sure you haven't made any mistakes typing the names of the controls
TotalScenarios and ScenariosTested? And just to make sure, what you've
quoted is the ControlSource property of the TestingTotal control, correct?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Beeyen said:
Thank you Mr Steele,

This is what I have in a field called TestingTotal:
=IIf([TotalScenarios]=0,1,([ScenariosTested]/[TotalScenarios])*30)

Yet, I am now recieving a #Name? as the return. Any ideas what I am still
doing wrong?

Douglas J. Steele said:
The reason it'll fail if Field2 is 0 is because you cannot have a
denominator of 0. The value of the numerator doesn't matter.

If you need the calculation in two places, put it in both places.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Beeyen said:
Thanks you for the quick response and the information. Will field1 fail
if
it
is 0?
Additionally, How can I have the total in field3 (located in subform1),
auto
populate to a field in subform2.

Thanks for the assistance!

:

In addition to what Tom posted, it'll fail whenever Field2 is 0.

You might want to use

=IIf([Field2]=0, 1, ([Field1] / [Field2]) * 30)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I would like to get a calculation from field1 and field2 to sum in
field3.

The coding in Field3 is as follows: =([Field1] / [Field2]) * 30.

But it does not seem to work, can someone tell me what I am doing
wrong??
 
Back
Top