dbTalk Databases Forums  

math problem converting currencies

comp.databases.ms-access comp.databases.ms-access


Discuss math problem converting currencies in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Co
 
Posts: n/a

Default math problem converting currencies - 10-28-2010 , 10:15 AM






Hi All,

I have a db table containing spot-rates for different currencies.
They all lead back to the euro. For example 0,125.
100 EGP -> EURO = 100 * 0,125 = 12,5 EURO.

Now I need a function to convert between the different currencies.
All I have is a form with two comboboxes. cboFrom and cboTo
which contain the different currencies. I read the values of the
spotrates
from a recordset. rstSpotRates.Fields("USD").

Is there an easy way to do this?
It should be able to convert for example:
USD - EURO
EURO - GBP
GBP - USD
EGP - EURO
EURO - EGP
USD - GBP etc.

Would be grateful,
Marco

Reply With Quote
  #2  
Old   
John Spencer
 
Posts: n/a

Default Re: math problem converting currencies - 10-28-2010 , 12:12 PM






The math is fairly simple.

To change US to GBP
Multiply the US Amount by the US Conversion factor and then Divide by the GBP
conversion factor

rstSpotRates.Fields("USD") * Amount / rstSpotRates.Fields("GBP")

If EUROs are involved then you need to divide or multiply the amount (depends
on direction) by the conversion factor.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Co wrote:
Quote:
Hi All,

I have a db table containing spot-rates for different currencies.
They all lead back to the euro. For example 0,125.
100 EGP -> EURO = 100 * 0,125 = 12,5 EURO.

Now I need a function to convert between the different currencies.
All I have is a form with two comboboxes. cboFrom and cboTo
which contain the different currencies. I read the values of the
spotrates
from a recordset. rstSpotRates.Fields("USD").

Is there an easy way to do this?
It should be able to convert for example:
USD - EURO
EURO - GBP
GBP - USD
EGP - EURO
EURO - EGP
USD - GBP etc.

Would be grateful,
Marco

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.