You should create a solution that normalizes your table of rates. For
instance an unnormalized table would look like (excuse the horrible
wrapping
and format but you should be able to understand the concept):
===un-normalized====
Currency names United Kingdom Pound Canadian Dollar Euro Japanese Yen
Swiss Franc US Dollar
United Kingdom Pound 1 0.4602 0.6855 0.005036 0.4416 0.55093
Canadian Dollar 2.1709 1 1.4882 0.010935 0.9587 1.19639
Euro 1.4582 0.6712 1 0.007346 0.6445 0.80361
Japanese Yen 198.47 91.3465 136.06 1 87.6282 109.36
Swiss Franc 2.2631 1.042 1.5512 0.011402 1 1.2475
US Dollar 1.8145 0.8353 1.2439 0.00914 0.8013 1
===Same data normalized====
CurrencyFrom CurrencyTo Rate
Canadian Dollar Canadian Dollar $1.00
Canadian Dollar Euro $0.67
Canadian Dollar Japanese Yen $91.35
Canadian DollarS wiss Franc $1.04
Canadian Dollar United Kingdom Pound $0.46
Canadian Dollar US Dollar $0.84
Euro Canadian Dollar $1.49
Euro Euro $1.00
Euro Japanese Yen $136.06
Euro Swiss Franc $1.55
Euro United Kingdom Pound $0.69
Euro US Dollar $1.24
Japanese Yen Canadian Dollar $0.01
Japanese Yen Euro $0.01
Japanese Yen Japanese Yen $1.00
Japanese Yen Swiss Franc $0.01
Japanese Yen United Kingdom Pound $0.01
Japanese Yen US Dollar $0.01
Swiss Franc Canadian Dollar $0.96
Swiss Franc Euro $0.64
Swiss Franc Japanese Yen $87.63
Swiss Franc Swiss Franc $1.00
Swiss Franc United Kingdom Pound $0.44
Swiss Franc US Dollar $0.80
United Kingdom Pound Canadian Dollar $2.17
United Kingdom Pound Euro $1.46
United Kingdom Pound Japanese Yen $198.47
United Kingdom Pound Swiss Franc $2.26
United Kingdom Pound United Kingdom Pound $1.00
United Kingdom Pound US Dollar $1.81
US Dollar Canadian Dollar $1.20
US Dollar Euro $0.80
US Dollar Japanese Yen $109.36
US Dollar Swiss Franc $1.25
US Dollar United Kingdom Pound $0.55
US Dollar US Dollar $1.00
--
Duane Hookom
MS Access MVP
sigeo said:
The IIF column would look like this: FieldWithYenAmount:
IIf([FieldCurrencyInetifier]="YEN",[FieldWithCurrency Amount],0)
Of course you would need to do this for all currencies and then SUM or
manipulate them in your reports.
:
Probably the most simple way is to calculate your currency in a query.
I
assume you have a table for rates as well as currency types and
amounts?
Use
the Query builder if you are new to Access. Add both tables to your
builder
and link them on the proper fields. In the top line of the Query
Builder,type. YenValue:= [FieldWithYenAmount]
Operator[FieldWithExchangeRate]
:
We assume you have a currency value like 4.345 and a currency type
such
as
"YEN" or "DOLLARS" or "FRANC" in fields in a table. Is this true?
Maybe you could provide a sample of significant fields and a could
records
as well as how you want something to display in a report?
--
Duane Hookom
MS Access MVP
Marsh,
Unfortunately, this is even more confusing for me. I am not sure
I
am
following you guys. Sorry, but I am a newbie with Access. How is
a
query
going to be able to decide if the original currency equals Yen
divid
by
this
number for Dollar and ALSO this number for Euro? This would is
the
situation
for the other 15 currencies. The query has to know what the
original
currency is and what number to divid/multiply to give me the
Dollar
and
Euro
equivalent. I thought IIF statements were the only way to
accomplish
this.
Could you give me a more simple description of what to do? Again,
you
guys
have been a real help. I await a response.
Thanks!
Ryan
:
Building on Duane's suggested table, you can the use a query
such as:
SELECT T.flda, T.fldb, . . . , T.amount, T.currency,
T.amount * X.rate As USDamount
FROM thetable As T LEFT JOIN tblExchangeRates As X
ON T.cuurency = X.FromCurrency
WHERE X.ToCurrency ="Dollars"
No IIfs at all and it'll be a lot faster and (hopefully)
easier to understand.
--
Marsh
MVP [MS Access]
Ryan G wrote:
I have about 16 different currencies that I use. I need to be
able
to
convert each one into EURO and DOLLARS. The currencies range
from
Australia
Dollar to Yen. The original amounts (in original currency) are
in
the
main
table. How can I convert each differenr currency in a query to
show in
a
report. It seems to me I would still have to use a long nested
IIF
function.
Correct? I hope I am wrong and there is some other easier way
to
do
this.
I have created a report that contains a field that has string
of
IIF
statements (15 to be exact) related to it. This concept of
this
field is the
following:
I have money in differenct currencies; the IIF statement
recognizes
what
currency it is then divides it by the exchange rate; this new
amount
is shown
in the field title "Amount in USD" for each record on my
report
I figured out the hard part of getting the string IIF
statements
to
work,
but in the footer of my report, I want to have a sum of the
'Total in
USD"
numbers I have created with the IIF function.
Basically, how do I sum and display the results of an IIF
function
within a
Report?
:
You should do the IIf calculation in the report's record
source query. This way the calculated field can be a simple
=Sum(USD)
The use of umpteen nested IIf functins sounds more than a
little scary, especially if the exchange rates are included
in the expression. I suggest that you try to find a way to
use a table of exchange rates and join that table to your
data table in the query. I might be able to help with this
if you'll explain how the amount and currency are specified.