How to get Total form lookup fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the table

Table Herd
IDUT Autonumber
CodFarmer txt
CodSemester txt
CodAnimal txt (lookup)
AnimalQuantity number
AnimalUnit number


I create the following sql to get the AnimalCarryingCapacity

SELECT F2Herd.CodFarmer, F2Herd.CodFarmer, F2Herd.CodAnimal,
F2Herd.AnimalQuantity, F2Herd. AnimalQuantity, [F2Herd]![
AnimalQuantity]*[F2Herd]![AnimalUnit] AS AnimalCarryingCapacity

FROM F2Herd

WHERE (((F2Herd.CodFarmer)="11") AND ((F2Herd. AnimalQuantity)>0));

The table shows all the AnimalCarryingCapacity per CodAnimal, CodSemester
and CodFarmer.

How can I create another table showing the CodFarmer with its total of
AnimalCarryingCapacity per CodSemester?

Your help is highly appreciated
 
SELECT SUM(AnimalQuantity*AnimalUnit), CodFarmer, CodSemester
FROM herd
GROUP BY CodFarmer, CodSemester


Hoping it may help,
Vanderghast, Access MVP
 
Works excellent. Thanks againg
Michel Walsh said:
SELECT SUM(AnimalQuantity*AnimalUnit), CodFarmer, CodSemester
FROM herd
GROUP BY CodFarmer, CodSemester


Hoping it may help,
Vanderghast, Access MVP


sebastico said:
I have the table

Table Herd
IDUT Autonumber
CodFarmer txt
CodSemester txt
CodAnimal txt (lookup)
AnimalQuantity number
AnimalUnit number


I create the following sql to get the AnimalCarryingCapacity

SELECT F2Herd.CodFarmer, F2Herd.CodFarmer, F2Herd.CodAnimal,
F2Herd.AnimalQuantity, F2Herd. AnimalQuantity, [F2Herd]![
AnimalQuantity]*[F2Herd]![AnimalUnit] AS AnimalCarryingCapacity

FROM F2Herd

WHERE (((F2Herd.CodFarmer)="11") AND ((F2Herd. AnimalQuantity)>0));

The table shows all the AnimalCarryingCapacity per CodAnimal, CodSemester
and CodFarmer.

How can I create another table showing the CodFarmer with its total of
AnimalCarryingCapacity per CodSemester?

Your help is highly appreciated
 

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

Back
Top