Quote:
Originally Posted by LSGKelly
...
I can't seem to pull the rates so that I can use them in calculations.
...
The usual way to extract rates from a (presumably tblRates) table is that they would be identified by some ID value.
The ID value is stored in the records of other tables where the rate is needed then the data is accessed via a query. In its simplest form you might have something like :
Table Name = [tblRates] Field Type Index - RateID String(1) PK
-
Rate Numeric
Some simple contents :
[tblRates] Data - RateID Rate
-
A 0
-
B 5
-
C 10
-
D 25
Table Name = [tblProducts] Field Type Index - ProdCode String PK
-
ProdDesc String(50)
-
Price Numeric
-
VATCode String(1) FK
Some simple contents :
[tblProduct] Data - ProdCode ProdDesc Price VATCode
-
AC1000 Paper ... 3.56 A
-
AC2000 Paper ... 4.90 A
-
BR1040 Office Equipment ... 34.12 B
-
BZ2010 Office Equipment ... 55.00 B
-
CD1000 Electronic Consumable ... 9.10 C
-
CX9800 Electronic Consumable ... 13.49 C
-
DD0560 Luxury Item ... 135.00 D
-
DM3320 Luxury Item ... 500.00 D
To expand this to show the rate and the increased price you would join the two tables using a query.
- SELECT tP.ProdCode,
-
tP.ProdDesc,
-
tP.Price,
-
tR.Rate AS VATRate,
-
tP.Price * (100 + tR.Rate) / 100 AS VATPrice
-
-
FROM tblProduct AS tP INNER JOIN
-
tblRates AS tR
-
ON tP.VATCode=tR.RateID
Giving :
[qryProduct] Results - ProdCode ProdDesc Price VATRate VATPrice
-
AC1000 Paper ... 3.56 0 3.56
-
AC2000 Paper ... 4.90 0 4.90
-
BR1040 Office Equipment ... 34.12 5 35.83
-
BZ2010 Office Equipment ... 55.00 5 57.75
-
CD1000 Electronic Consumable ... 9.10 10 10.01
-
CX9800 Electronic Consumable ... 13.49 10 14.84
-
DD0560 Luxury Item ... 135.00 25 168.75
-
DM3320 Luxury Item ... 500.00 25 625.00