Best Way to set up fields in table

  • Thread starter Thread starter Chaster
  • Start date Start date
C

Chaster

I know this is a table questions but the calculations are going to be done
on my form so thought I might throw it out here.

I am creating a new table and will be doing caluclation based on 3 fields
[length], [width], [height]

I originaly set these up as numbers longinteger 0 decmial places.
Went back and changed them to number, double, 0 decmial places.

My calculation would be ([length]*[width]*[height])/250

when my fields = (48*51*43)/250 it returns a value of 96099.84
when I do this on my calculator it returns the value of 421.0560 (This value
is correct)

My questions are:
What would be the best way to set up my fields in the table?
Double, Integer, etc, etc

Whats wrong with the above calculation that it does not return the correct
value?

TIA
 
Thank you. I am not storing the results in a table but calculating it in a
textbox on my form.

The calculation is not working properly though. I just put a new textbox on
my form and set the control source to
=(48*51*43)/250 and the results come up correctly as 421.0560

If I put the same data into my fields and then do the calculation in another
textbox [DimWgt] and set the control source to
=([length]*[width]*[height])/250 It displays a value of 96099.84 ?

The table properties of each field is
Length = Number, Long Interger, 0
Width = Number, Long Integer, 0
Height = Number, Long Intger, 0

???

Allen Browne said:
If the 48, 51, and 43 will always be whole numbers, use fields of type Long.
If you will ever need them to handle fractional numbers, use fields of type
Double.

Don't store the calculation in the table. Instead use a calculated field in
a query, by entering something like this into a fresh column of the query
design grid (Field row):
Result: ([length]*[width]*[height])/250
That way the result can never be wrong.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
I know this is a table questions but the calculations are going to be done
on my form so thought I might throw it out here.

I am creating a new table and will be doing caluclation based on 3 fields
[length], [width], [height]

I originaly set these up as numbers longinteger 0 decmial places.
Went back and changed them to number, double, 0 decmial places.

My calculation would be ([length]*[width]*[height])/250

when my fields = (48*51*43)/250 it returns a value of 96099.84
when I do this on my calculator it returns the value of 421.0560 (This value
is correct)

My questions are:
What would be the best way to set up my fields in the table?
Double, Integer, etc, etc

Whats wrong with the above calculation that it does not return the correct
value?
 
-----Original Message-----
If the 48, 51, and 43 will always be whole numbers, use fields of type Long.
If you will ever need them to handle fractional numbers, use fields of type
Double.

Don't store the calculation in the table. Instead use a calculated field in
a query, by entering something like this into a fresh column of the query
design grid (Field row):
Result: ([length]*[width]*[height])/250
That way the result can never be wrong.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
I know this is a table questions but the calculations are going to be done
on my form so thought I might throw it out here.

I am creating a new table and will be doing caluclation based on 3 fields
[length], [width], [height]

I originaly set these up as numbers longinteger 0 decmial places.
Went back and changed them to number, double, 0 decmial places.

My calculation would be ([length]*[width]*[height])/250

when my fields = (48*51*43)/250 it returns a value of 96099.84
when I do this on my calculator it returns the value of
421.0560 (This
value
is correct)

My questions are:
What would be the best way to set up my fields in the table?
Double, Integer, etc, etc

Whats wrong with the above calculation that it does not return the correct
value?


.
I have no idea if everything is correct the way you
describe it. If it were, you should get correct results.

Just remember that mathematical calculations use need the
data-type the parts of it's formula and the result should
be rounded. For instance, if you multiply an integer
times a double, the result should be double. If you want
to round it, then use the round function.
 
Just to test that the [length], [width], and [height] are actually the
values that you think they are, put three textboxes on your form and bind
them to these fields. Do those textboxes display the correct values? My
thinking is that you may have a field that is named [length] and a control
named [length] but that the control is not bound to the field, and thus
ACCESS may be using a value that you don't anticipate.

--
Ken Snell
<MS ACCESS MVP>

Chaster said:
Thank you. I am not storing the results in a table but calculating it in a
textbox on my form.

The calculation is not working properly though. I just put a new textbox on
my form and set the control source to
=(48*51*43)/250 and the results come up correctly as 421.0560

If I put the same data into my fields and then do the calculation in another
textbox [DimWgt] and set the control source to
=([length]*[width]*[height])/250 It displays a value of 96099.84 ?

The table properties of each field is
Length = Number, Long Interger, 0
Width = Number, Long Integer, 0
Height = Number, Long Intger, 0

???

Allen Browne said:
If the 48, 51, and 43 will always be whole numbers, use fields of type Long.
If you will ever need them to handle fractional numbers, use fields of type
Double.

Don't store the calculation in the table. Instead use a calculated field in
a query, by entering something like this into a fresh column of the query
design grid (Field row):
Result: ([length]*[width]*[height])/250
That way the result can never be wrong.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
I know this is a table questions but the calculations are going to be done
on my form so thought I might throw it out here.

I am creating a new table and will be doing caluclation based on 3 fields
[length], [width], [height]

I originaly set these up as numbers longinteger 0 decmial places.
Went back and changed them to number, double, 0 decmial places.

My calculation would be ([length]*[width]*[height])/250

when my fields = (48*51*43)/250 it returns a value of 96099.84
when I do this on my calculator it returns the value of 421.0560 (This value
is correct)

My questions are:
What would be the best way to set up my fields in the table?
Double, Integer, etc, etc

Whats wrong with the above calculation that it does not return the correct
value?
 
Chaster, forms have a Width property, so I wonder if Access is interpreting
[Width]
to mean the width of the form in twips? That would be consistent with the
absurdly large value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
Thank you. I am not storing the results in a table but calculating it in a
textbox on my form.

The calculation is not working properly though. I just put a new textbox on
my form and set the control source to
=(48*51*43)/250 and the results come up correctly as 421.0560

If I put the same data into my fields and then do the calculation in another
textbox [DimWgt] and set the control source to
=([length]*[width]*[height])/250 It displays a value of 96099.84 ?

The table properties of each field is
Length = Number, Long Interger, 0
Width = Number, Long Integer, 0
Height = Number, Long Intger, 0

???

Allen Browne said:
If the 48, 51, and 43 will always be whole numbers, use fields of type Long.
If you will ever need them to handle fractional numbers, use fields of type
Double.

Don't store the calculation in the table. Instead use a calculated field in
a query, by entering something like this into a fresh column of the query
design grid (Field row):
Result: ([length]*[width]*[height])/250
That way the result can never be wrong.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Chaster said:
I know this is a table questions but the calculations are going to be done
on my form so thought I might throw it out here.

I am creating a new table and will be doing caluclation based on 3 fields
[length], [width], [height]

I originaly set these up as numbers longinteger 0 decmial places.
Went back and changed them to number, double, 0 decmial places.

My calculation would be ([length]*[width]*[height])/250

when my fields = (48*51*43)/250 it returns a value of 96099.84
when I do this on my calculator it returns the value of 421.0560 (This value
is correct)

My questions are:
What would be the best way to set up my fields in the table?
Double, Integer, etc, etc

Whats wrong with the above calculation that it does not return the correct
value?
 
Back
Top