I made a form in aceess, which contains a subform, where the subform's control source is a query without a filter, and the subform filter criteria are generated in the form using VBA.
Example: After the form enters the filter criteria, the subform filter results are:
Customer field 1 Field 2 .... (Child form header)
A 1 2
B 0 1
C 2 1
A 1 0
Total Customer 4 4 .... (Sub-form footer, to count the number of each field)
Because the customer field repeats, I want to create a new text box in the footer of the subform to count the number of customer repetitions after each form filter result and display them in the file box. Tried a lot of ways not, distinct in the text box control source does not apply. Can the control source in the text box be implemented? What is the way to ask the Masters?
Question added: This SELECT statement I know, but only in the query, I do not know if I want the functionality in the subform implementation?
Best Answer
For a SELECT statement, the Access database can support the DISTINCT keyword, but the aggregate function does not support the
You can write that.
Select COUNT (*) from (select distinct the field name to be counted from the table name)