Dcount with parameter from form on Expression Builder

on76brg

New member
Local time
Today, 22:12
Joined
Mar 21, 2013
Messages
3
hello all,

i searched here on the forum but could not find any topic so i opened a thread. Alreday my sorry if am redudant.

My problem:
I want to count the number of occurences in a datatable when loading a form. BUT i want only to count if it is equal to a value on a text box on this same form.

what i made:
1-created a unbound textbox
2-inserted on "control Source" this expression =DCount("*";"T_Pendentes";"[disponente.Procurement]= " & [me].[disponenteProcurement].[Value] & "")

where * is to count all, T_Pendentes is the table, and de expression is the criteria.

hope i made myself understood :o
 
found it!! in this forum!!
DCount("Field","TableName","Field=" & ValueToCount)

Or for a text field

DCount("Field","TableName","Field='" & ValueToCount & "'")

ValueToCount can either be a fixed value or referenced from a control (such as the combobox if that will be active when the report/query is run).

Another option would be to create a query listing distinct values in that field (SELECT DISTINCT query) and use the dCount() function against each value returned.

i tried to insert here the link of the topic on this forum but could not as it is my first reply.

thank you
 

Users who are viewing this thread

Back
Top Bottom