ok you need a series of tables
tblfarmer
farmerid,autonumber,id field for farmer
farmername, text, name of farmer
otherfarmerdetails
tblvariety
varietyid,autonumber,id field for fruit
varietyname,text,name of fruit
othervarietydetails
tblcaliber
caliberid,autonumber,id field for caliber
calibersize,number,size of caliber ie 16 or 18
othercaliberdetails
tblprice
priceid,autonumber,id field for price
caliberid,number,fielding connecting calaber to price
pricestartdate,date/time,start date of price
priceenddate,date/time,end dat of price
priceamount,currency,value of price per KG
varietyid,number,id linking fruit to price
tblwarehouse
warehouseid,autonumber,id field for warehouse
farmerid,number,field connecting farmer to entry in warehouse
varietyid,number,field connecting fruit to entry in warehouse
caliberid,number,field connecting calaber to entry in warehouse
warehouseentrydate,date/time,date of entry in warehouse
entryquantity,number,weight of fruit of this calaber in warehouse
entrypaid,yes/no,money has been paid for the entry
the entry paid field may not be needed and you could just sue two date
ranged from begining fo autumn to end of autumn i think it is better
to do date ranges rather than using that field.
so in this example tblwarehouse is the most important table
it would store
warehouseid farmerid varietyid,calaberid,warehouseenrtydate
1 1 1 1
01/01/2008
2 1 3 2
01/01/2008
etc
from this we can get the information you want
then this query joins it all up for you
SELECT tblfarmer.farmername, tblvariety.varietyname,
tblcaliber.calibersize, tblwarehouse.warehouseentrydate,
tblwarehouse.entryquantity, (select subprice.priceamount from tblprice
as subprice where tblwarehouse.varietyid = subprice.varietyid and
tblwarehouse.caliberid = subprice.caliberid and
tblwarehouse.warehouseentrydate between subprice.pricestartdate and
subprice.priceenddate) AS priceamount
FROM tblcaliber INNER JOIN (tblvariety INNER JOIN (tblfarmer INNER
JOIN tblwarehouse ON tblfarmer.farmerid = tblwarehouse.farmerid) ON
tblvariety.varietyid = tblwarehouse.varietyid) ON tblcaliber.caliberid
= tblwarehouse.caliberid;
so you would see something like
farmername,varietyname, calibersize, warehouseentrydate,
entryquantity, priceamount
bob,apples,16,1/01/2008, 5, $5.00
bob,apples,16,1/01/2008,6,$5.00
bob,apples,16,4/01/2008,3,$6.00
frank,apples,16,1/01/2008,10,$5.00
this is what you are looking for then you can do a simple query
SELECT [get warehouse info].farmername,
Sum([entryquantity]*[priceamount]) AS [amount owed]
FROM [get warehouse info]
WHERE ((([get warehouse info].warehouseentrydate) Between [enter start
date] And [enter end date]))
GROUP BY [get warehouse info].farmername;
to get the total amount owed to each farmer
if you want a copy of what i was working on ie the db file send me
your email and ill send you a copy of it unless you think you can
build it yourself
hope this helps
Regards
Kelvan