Access statistics do not repeat the number of records

Source: Internet
Author: User
Tags count table name access database

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 experts?

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.