Calculations in Query

B

Bell

I'm having a currency, sumofnetprice and sumofvat field in my query and now I
want to calculate what the sumofnetprice and sumofvat equals in my local
currency. Hence I have created a table called ExchangeRates with the fields
period, usd and eur. Now I want my query to pick the correct exchange rate
for a specific period that is based on the form ParamFormFor that returns a
period. However I'm uncertain of how carry this out in practice.

Greatful to answers / Bell
 
M

MGFoster

Bell said:
I'm having a currency, sumofnetprice and sumofvat field in my query and now I
want to calculate what the sumofnetprice and sumofvat equals in my local
currency. Hence I have created a table called ExchangeRates with the fields
period, usd and eur. Now I want my query to pick the correct exchange rate
for a specific period that is based on the form ParamFormFor that returns a
period. However I'm uncertain of how carry this out in practice.

Greatful to answers / Bell

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could use a subquery or a domain aggregate function to get the
Exchange Rate. Use a Form reference parameter to read the period.
E.g.:

PARAMETERS Forms!FormName!PeriodControlName Integer;

SELECT <column list> ,

(SELECT usd FROM ExchangeRates WHERE Period =
Forms!FormName!PeriodControlName AND eur = SumOfNetPrice) As NetUSDValue

FROM <table name>

WHERE <criteria>

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQw9oQYechKqOuFEgEQKXNACg6equcumTHYLUyyktRMgcOh6Xc70Anj5b
EF1rYKuEq67LHsDwitdcAdjU
=Q0lK
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top