473,508 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access: DCount Code help

88 New Member
This is what I have:
=DCount(-"[Action Date]","Action Log","[Action Type] = 'Complete'")

I placed it in a criteria field in a Query. File Name reads "Action Date"

I need to count how many Records have an Action Date if the Action Type doesn't = Complete.
Sep 13 '10 #1
8 2585
SusanK4305
88 New Member
Sorry not File Name... it should be Field Name
Sep 13 '10 #2
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. When you mention that you want to count the records which have an action date is it the case that for those records that don't the Action Date field is null? If so you will need to include this in the Where clause. You will also need to change the '=' to '<>' in the Where clause and remove the '-' at the start of the DCount.

Finally, as you are counting rows the 'Count all' symbol, "*", can be used instead of a specific field:

Expand|Select|Wrap|Line Numbers
  1. =DCount("*","Action Log","[Action Type] <> 'Complete' AND [Action Date] IS NOT NULL")
-Stewart
Sep 13 '10 #3
SusanK4305
88 New Member
Correct the Records that should be counted are ones w/o an Action Type that = Complete and therefore will not have a date because the action "complete" will not even be in JAne Doe's action records.

I tried entering ur code insted of mine (which btw I know was Incorrect but I thought it could help explain what i was looking for :) ) but it didn't work I am going to try it as an Expr1:
Sep 14 '10 #4
SusanK4305
88 New Member
Yay! That worked... Thank you so much. one task down many more aspirin's to go.

For others that find this and need it.

Please note: Action Log (table name), Action Type(dropdown options w/ in Action Log), Complete (Criteria),and Action Date (Date time field w/in Action Log) are the areas that u will change to match your database.
As a Field Name place this in your Query:

Expr1: DCount("*","Action Log","[Action Type] <> 'Complete' AND [Action Date] IS NOT NULL")

And Expression in the Total type
Sep 14 '10 #5
SusanK4305
88 New Member
ok I don't know what I did but I jacked somthing up.
have the above exp where it is and another
Expr2: " [tblAction Log].[Action Date] Between [Start Date] And [End Date]" as a count. I have a total of 14 records to be sorted 2 Completed.
This is what i get when I run the query

Action Type CountOfAction Date Expr1 Expr2
Delayed 6 12 6
Issue Complete 2 12 2
New Security Packet 1 12 1
OPM Rejection 1 12 1
Other 2 12 2
Sent to EOD 2 12 2
Sep 16 '10 #6
SusanK4305
88 New Member
Correction:

Action Type CountOfAction Date Expr1 Expr2
Delayed 6 12 6
Issue Complete 2 12 2
New Security Packet 1 12 1
OPM Rejection 1 12 1
Other 2 12 2
Complete 2 12 2
Sep 16 '10 #7
SusanK4305
88 New Member
Ok Well I cant get it to line up. so Delay should = 4 because there are 2 completed packets. Exp 1 is counting all records and the Date is counting w/o exp 1. Y?
Sep 16 '10 #8
SusanK4305
88 New Member
Please some one help.
I need this Expr1: DCount("*","tblAction Log","[Action Type] <> 'Sent to EOD' AND [Action Date] IS NOT NULL")
to work only for Action types that read "Delay".

Example: I have 17 total records
Delay ..... 5
Dropped ...... 1
New ..... 7
Complete ..... 4

When I add the bove Expr I get 13 for all, but I only need the Expr to work for "Delayed"

So it should look like this

Delay ..... 1 (this is Delay (5)- Completed (4))
Dropped ..... 1
New ..... 7
Complete ..... 4

How do I do this.

* Please not this info will be put in a report. I have a nother question post for the report part but you may want to read it to find out the end game.
Thank you!
Sep 29 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5396
by: Sergio del Amo | last post by:
Hi, I implemented a Web-Site based in remote scripting with hidden frames. I am using Javascript to provide dynamic functionality. In the machine's local server works perfectly but when i uploaded...
1
1371
by: Mike Ridley | last post by:
I have just inherited an Access Booking Application. Works fine, including some quite complex code that calculates an availability table from dates input by the user. I have produced a simple...
5
1603
by: MLH | last post by:
I had a form (Form12) with a code error in it. I knew it was there. I even planned on fixing it (someday). I needed a comprehensive test of all my code so I clicked Debug, Compile All Modules. My...
26
2643
by: jamesbeswick | last post by:
I've been using Access since version 97 and I've migrated to 2003. I've noticed a substantial number of strange ActiveX/OLE and code corruption problems when writing databases. The only solution...
2
1733
by: Kaspa | last post by:
Hello I am trying to create dcount field but is not working I have tried every way possible and I can't get it to work. here is my code: =Dcount("","qryTotalscratched"," in (6,7,8,9) and ...
1
8751
by: vadarv | last post by:
Hia! I'm a total amateur to VBS but need help on a VBS script. This is used in a HMI system from Siemens called WinCC, used for process viewing and control. What I need to is to write to a table...
3
2824
by: Coby Herd | last post by:
I keep getting the error message - Error Type: Microsoft JET Database Engine (0x80004005) Unrecognized database format 'c:\inetpub\wwwroot\blog\db\blog.mdb'. /blog/admin/Default.asp, line 14 ...
4
2950
by: Ben | last post by:
Hi, i have some problem to access from code-behind a label nested into a CreateWizard control. I use a html-table for align purpose only. I try to change the text property of the label with...
5
15425
by: jasperz01 | last post by:
Hi, Is it possible using Office Automation to freeze panes in Excel from Access VBA code? I've been trying some things but can't get it right... Jasper
0
2978
by: JFKJr | last post by:
I have an excel file, which has columns C and D grouped together, I am trying to delete blank columns and rows from the excel file, ungroup the columns and import the file to MS Access using Access...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.