Hi, I have a report based on a query, which is based on a form. The SQL statement for the query, named [csCriancasTurmas], is
and I want to count the values of [Atividade] inside the report. Translated to english, this is a students database in which each student has several activities. (Atividade -> Activities). In the report, it shows all activities and presences (Presenças -> Presences ... PlanoDiário -> Summary) and I would like to count the number of activities each student has. The "problem" (... i guess) is that the query is based on a form. If it wasn't and i had a "simple" dcount function it would been this way, right? :
I tried many dcount strings .. here's the latest, which doesn't work
Simplifying,
I'm sorry the presentation of what i want to say is maybe a bit confusing... I just don't know what to do more.
Thank you,
Tiago
Code:
SELECT DISTINCTROW PlanoDiario.Presenças.Value, Turmas.Crianças.Value, Atividades.Atividade, Atividades.Docente, PlanoDiario.Data, PlanoDiario.Hora, PlanoDiario.[Licao nº], PlanoDiario.Sumário, PlanoDiario.Turma2
FROM Turmas INNER JOIN (Atividades INNER JOIN PlanoDiario ON Atividades.ID = PlanoDiario.Atividade) ON Turmas.ID = PlanoDiario.Turma2
WHERE (((PlanoDiario.Presenças.Value) Like ([Formulários]![Registo_teste_criancas_tudo]![Nome Próprio] & " " & [Formulários]![Registo_teste_criancas_tudo]![Aplelido])) AND ((Turmas.Crianças.Value) Like ([Formulários]![Registo_teste_criancas_tudo]![Nome Próprio] & " " & [Formulários]![Registo_teste_criancas_tudo]![Aplelido])));
Code:
=Dcount("csCriancasTurmas";"Atividade")
Code:
=DContar("csCriancasTurmas";"Atividade";"(([Planodiario.presenças]='" & [Formulários]![Registo_teste_criancas_tudo]![Nome Próprio] & " " & [Formulários]![Registo_teste_criancas_tudo]![Aplelido] & "') AND ([Turmas.Crianças]='" & [Formulários]![Registo_teste_criancas_tudo]![Nome Próprio] & " " & [Formulários]![Registo_teste_criancas_tudo]![Aplelido] & "'))")
Code:
=DContar("queryname";"fieldwhichIwanttocount";"parameters")
with
Parameters = (([Planodiario.presenças.value]='" & [Forms]![Registo_teste_criancas_tudo]![Nome Próprio] & " " & [Forms]![Registo_teste_criancas_tudo]![Aplelido] & "') AND ([Turmas.Crianças.value]='" & [Formulários]![Registo_teste_criancas_tudo]![Nome Próprio] & " " & [Formulários]![Registo_teste_criancas_tudo]![Aplelido] & "'))")
I forgot to say that fields in the query and report, named [Planodiario.Presenças] and [Turmas.Crianças] are multiselection values :((((
Thank you,
Tiago