Number of non-Repeated Records in ACCESS statistics

Source: Internet
Author: User
I made a form in ACEESS, which contains a subform. The control source of the subform is a query without filtering conditions. In the form, a subform filtering condition is generated using VBA. For example, after filtering conditions are entered in the form, the subform filter result is: Customer Field 1 Field 2... (subform header) A12B01C21A10? 44 customers... (sub

I made a form in ACEESS, which contains a subform. The control source of the subform is a query without filtering conditions. In the form, a subform filtering condition is generated using VBA. For example, after filtering conditions are entered in the form, the subform filter result is: Customer Field 1 Field 2 .... (subform header) A 1 2 B 0 1 C 2 1 A 1 0 total? Customers 4 4... (sub

I made a form in ACEESS, which contains a subform. The control source of the subform is a query without filtering conditions. In the form, a subform filtering condition is generated using VBA.

For example, after filtering conditions are entered in the form, the subform filter result is:

Customer Field 1 Field 2... (subform header)

A 1 2

B 0 1

C 2 1

A 1 0

Total? Customers 4... (child form footer, used to calculate the sum of the number of each field)

Because the customer fields will be repeated, I want to create a text box in the footer of the child form, count the number of unique users after each form filter result, and display it in the file box. I tried many methods, but DISTINCT does not apply to the control source of the text box. Can the control source in the text box be implemented? How can I consult experts?

Question added: I know this select statement, but it can only be used in queries. I don't know if the functions I want can be implemented in subforms?

Best Answer

For select statements, the access Database supports the DISTINCT keyword, but the clustering function does not.

It can be written in this way.

Select count (*) from (select distinct field name to be counted from 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.