Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating field values from another field 1

Status
Not open for further replies.

IANGRAND

Technical User
Jul 29, 2003
92
GB
My table consists of date, Place, ppb (parts per billion) and ug/mg3.

I have the value for ppb(parts per billion)and am required to convert this into ug/mg3. The conversion only requires me to multiply the ppb by 1.91.

How do i set the table up so that ug/mg3 will look at the value in ppb, calculate the new value and populate the field.
 
Calculations can be done on the fly for reports and forms. You can set an unbound text box's control to " =[ppb]*1.91 " (omit the quotes) and label it ug/mg3.

If you really want to store it in a table and are using an input form, you can set the value of the ug/mg3 field programatically use the after update on the ppb field:

Private Sub PPB_AfterUpdate()

Me.[ug/mg3] = Me.[PPB]*1.91

End Sub


Hope this helps
 
Great it works, but the problem is that it rounds up the values. 27*1.91 = 51.75, but it rounds it up to 52.

any ideas?

Regards

Ian Grand
 
I ran into this in a database I built. The solution I was given here, and it worked well was to set the Field size to Double, Format to Fixed and Decimal Places to 2 (or how many you need).

Hope this helps
 
Cracking, it works a treat

Cheers

Ian Grand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top