I can’t get any form of COUNT or DCOUNT to work on my query. I’ve attached a print screen of the data. I want to be able to reflect the number of times the particular afq appears in the data. Seems simple. Why can’t I get it to work?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
DCOUNT (Access 03 SP2)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » DCOUNT (Access 03 SP2)
- This topic has 6 replies, 2 voices, and was last updated 18 years ago.
AuthorTopicWScchambers@work
AskWoody LoungerMarch 27, 2007 at 3:59 pm #441042Viewing 0 reply threadsAuthorReplies-
WSHansV
AskWoody Lounger -
WScchambers@work
AskWoody Lounger -
WSHansV
AskWoody LoungerMarch 27, 2007 at 4:25 pm #1057951Does this expression do what you want?
DCount("*","TableName","afq=" & Chr(34) & [afq] & Chr(34))
Replace TableName with the name of the table (or query) your query is based on.Note: with 200,000 records, this will be very slow.
You could also create a Totals query that has only the field afq twice, the first with Group By as Total option, the second with Count.
-
WScchambers@work
AskWoody LoungerMarch 27, 2007 at 6:09 pm #1057964I’m not getting anywhere fast. What I want to have happen is a new calculated field that shows how many times that AFQ appears. I’ve adjusted the sample to show this. For example, in the 1st one (1.13) that particular AFQ shows up 30 times out of the 200,000 records. In excel, this would be a simple COUNTIF(RANGE,CRITERIA). The problem you know is the 200,000 records. Maybe your DCOUNT formula works, but due to the size, you right, it’s too slow to use. The totals are working, so maybe I’m doing something wrong there. I’m at a loss. Any ideas, Hans? THANKS!!!!!
-
WSHansV
AskWoody LoungerMarch 27, 2007 at 6:27 pm #1057968Try the following:
1) Create a query based on your table.
Select View | Totals or click the Totals button on the toolbar.
Add the afq field to the query grid twice.
Don’t add any other fields to the query grid.
Set the Total option for the first column to Group By (this is the default anyway).
Set the Total option for the second column to Count.
Save this query as qryCountAFQ.
If you open the query in datasheet view, it should display the count for each afq in a reasonable amount of time.2) Create a query based on your table and on qryCountAFQ.
Join them on the afq field.
Add all fields from the table that you need to the query grid.
Add the CountOfafq field from qryCountAFQ to the query grid.
This query should display the count of afq’s. -
WScchambers@work
AskWoody Lounger
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
My 3 monitors go black & then the Taskbar is moved to center monitor
by
saturn2233
6 hours, 18 minutes ago -
Apple backports fixes
by
Susan Bradley
6 hours, 27 minutes ago -
Win 11 24H2 will not install
by
Michael1950
6 hours, 32 minutes ago -
Advice to convert MBR to GPT and install Windows 11 Pro on unsupported PC
by
Andy M
6 hours, 3 minutes ago -
Photos from iPhone to Win 10 duplicating/reformatting to .mov
by
J9438
8 hours, 11 minutes ago -
Thunderbird in trouble. Here comes Thundermail
by
Alex5723
6 hours, 20 minutes ago -
Get back ” Open With” in context menus
by
CWBillow
19 hours, 12 minutes ago -
Many AMD Ryzen 9800X3D on ASRock have died
by
Alex5723
22 hours, 59 minutes ago -
simple general stupid question
by
WSaltamirano
16 hours, 59 minutes ago -
April 2025 Office non-Security updates
by
PKCano
1 day, 10 hours ago -
Microsoft wants to hear from you
by
Will Fastie
10 hours, 6 minutes ago -
Windows 11 Insider Preview Build 22635.5160 (23H2) released to BETA
by
joep517
1 day, 13 hours ago -
Europe Seeks Alternatives to U.S. Cloud Providers
by
Alex5723
1 day, 19 hours ago -
Test post
by
Susan Bradley
1 day, 21 hours ago -
Used Systems to delete Temp files Gone WRONG what does this mean?
by
Deo
1 day, 23 hours ago -
SSD shuts down on its own
by
CWBillow
1 day, 14 hours ago -
OneDrive File Sharing Changes
by
David Clark
2 days, 7 hours ago -
OneDrive File Sharing Changes
by
David Clark
2 days, 9 hours ago -
Win 10 Pro 22H2 to Win 11 Pro 23H2 Conversion Guide
by
doneager
1 day, 9 hours ago -
Today is world backup day
by
Alex5723
2 days ago -
Windows .exe on Mint
by
Slowpoke47
5 hours, 46 minutes ago -
Reviewing your licensing options
by
Susan Bradley
6 hours, 40 minutes ago -
Apple has been analyzing your photos since September 2024
by
B. Livingston
1 day, 5 hours ago -
What Windows 11 24H2 offers beyond bugs
by
Lance Whitney
1 day, 1 hour ago -
Making sense of Settings in Windows 11
by
Simon Bisson
1 day, 3 hours ago -
Windows 11 pro fails to log in after upgrading Win 10 pro to Win 11 pro 24h2
by
ben_sitaud
2 days, 6 hours ago -
23H2 / 24H2 / Local v. Microsoft Account.
by
CWBillow
2 days, 4 hours ago -
YouTube Ad Blocker Blocker
by
bbearren
2 days, 4 hours ago -
Obscure historical facts about Windows
by
Cybertooth
2 days, 6 hours ago -
Microsoft Backup
by
Linda2019
1 day, 22 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.