How to pass a count and sum value from one table to a not linked control in a form wi (1 Viewer)

Everterra

Registered User.
Local time
Today, 12:55
Joined
Jan 12, 2015
Messages
16
Hello.


In Access 2013 I have 2 tables

tbAssembleias
tbEntities

The tbEntities, have a fiel called tbPresent (yes/no) to register the presents in a condominium meeting.


Table Name: tbEntities


Fields:


tbEntId...tbPresent (yes / no)..........tbVotes
1.........ye...........................5
2.........no...........................3
3.........yes..........................4
4.........no...........................6​


In the form is the table tbAssembleias, but I want to put from the other table which is not present in the form:

1. a control that count how many are present (= yes)
Ex: Appearances 2​
2. a control that sum the votes of those present
Ex: Votes 9​

I already have a query that count how many are in the meeting, but cant realize how to pass the information to the field in the form...

This is the SQL view of the query with the real field names - and working:

SELECT Count(tbEntidades.tbAssPresente) AS ContaPresentes, tbEntidades.tbAssPresente
FROM tbEntidades
GROUP BY tbEntidades.tbAssPresente
HAVING (((Count(tbEntidades.tbAssPresente))=True) AND ((tbEntidades.tbAssPresente)=True));​


Can somebody help with this?

Thanks.
Everterra.
 

Everterra

Registered User.
Local time
Today, 12:55
Joined
Jan 12, 2015
Messages
16
Ok, resolved

Using a listbox, >Properties >Source >Source line, and using there the Constructor, I mounted a query.


For the fist list box to show the Count, the result was:


SELECT Count(tbEntidades.tbAssPresente) AS ContaPresentes, tbEntidades.tbAssPresente
FROM tbEntidades
GROUP BY tbEntidades.tbAssPresente
HAVING (((Count(tbEntidades.tbAssPresente))=True) AND ((tbEntidades.tbAssPresente)=True));


For the second list box to show the Sum, the result was:


SELECT Sum(tbFrações.tbFrPerc) AS SomaDetbFrPerc, tbEntidades.tbAssPresente
FROM tbFrações
INNER JOIN tbEntidades ON tbFrações.tbFrId = tbEntidades.tbFrações.Value
GROUP BY tbEntidades.tbAssPresente
HAVING (((tbEntidades.tbAssPresente)=True));
 

Users who are viewing this thread

Top Bottom