Calculating Field values

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??
 
T

Tom Lake

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
 
D

Douglas J. Steele

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)
 
B

Beeyen

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??
 
D

Douglas J. Steele

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??
 
B

Beeyen

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??
 
D

Douglas J. Steele

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??
 

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