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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default values.. please help, need to perform a calculation

Status
Not open for further replies.

closing

Technical User
Dec 4, 2001
7
GB
Hi there

I have a database in it I have 3 Field
Field 1 is called Cost
Field 2 is called Rate
Field 3 is called Total

What I would like is for the DEFAULT VALUE in the Database design for the Total Field (field 3) to equal Cost * Rate.

This ideally needs to be done in the table and not in a report (where I know its dead easy) due to me using a PayPal shopping cart.

The idea is that Cost is in UK pounds and Rate is the Exchange rate and Total will be the converted amount. Or if anyone has a shopping cart for Nochex that would be great.

Thanks
 
Setup an update query. Make sure your tables Field values are set to Currency. Make the Rate Currency Field format a Percent. Be sure to input the Rate field data as .01 for 1%, etc. It's times 100 for % values. So you'll have to do some math so you don't get extremely small or large numbers, u know what I mean.

In the query, add the table you are working with and add the Total Field. Change the query to an update query. In the UPdate To box put this in there

[tblEraseMe]![Cost] * [tblEraseMe]![Rate]

Edit tblMyTable to your table name.

Run the updatequery whenever you want to add the Rate and Cost fields. fields and place them into the Total box.

It works, I just tested it.

-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top