473,770 Members | 3,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Count Dates with a Criteria

Hi, I have a simple question. I wanted to count a Column containing
Dates and the word "Empty".

This is what I am trying to do.

Closed Dates
------------
4/2/2004
4/7/2004
4/9/2004
Empty
4/5/2004
7/3/2004
Empty
Empty
And come out with

Empty: 3

and in another query

Date: 5
Here is what I am attempting, but I am getting a data type mismatch
error.. I am trying to using "Empty" and Not "Empty"

SELECT Count(aparFullT able.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
HAVING (((Count(aparFu llTable.[PTF Closed]))="empty"));
Thanks
Nov 13 '05 #1
2 1359
al******@hotmai l.com (Alicia) wrote in message news:<d3******* *************** ****@posting.go ogle.com>...
Hi, I have a simple question. I wanted to count a Column containing
Dates and the word "Empty".

This is what I am trying to do.

Closed Dates
------------
4/2/2004
4/7/2004
4/9/2004
Empty
4/5/2004
7/3/2004
Empty
Empty
And come out with

Empty: 3

and in another query

Date: 5
Here is what I am attempting, but I am getting a data type mismatch
error.. I am trying to using "Empty" and Not "Empty"

SELECT Count(aparFullT able.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
HAVING (((Count(aparFu llTable.[PTF Closed]))="empty"));
Thanks

This should work for you. You can't say Count(fieldname ) = "empty"
for Count is numeric. Also this should be Where not Having

SELECT Count(aparFullT able.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
Where aparFullTable.[PTF Closed]="empty";
Nov 13 '05 #2
You should be using "WHERE" rather than "HAVING"

SELECT Count(aparFullT able.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
WHERE (((Count(aparFu llTable.[PTF Closed]))="empty"));

al******@hotmai l.com (Alicia) wrote in message news:<d3******* *************** ****@posting.go ogle.com>...

Here is what I am attempting, but I am getting a data type mismatch
error.. I am trying to using "Empty" and Not "Empty"

SELECT Count(aparFullT able.[PTF Closed]) AS [CountOfPTF Closed]
FROM aparFullTable
HAVING (((Count(aparFu llTable.[PTF Closed]))="empty"));
Thanks

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3510
by: Irfan | last post by:
Hi All, I am trying to create a report but having problem with the critiera selection logic, please help. I have the following fields date1 date2 date3
3
4801
by: Michael Curtis | last post by:
This is kicking my @#$%. I have been asked to do a performance report for our vendors. I need to compare and count dates. 1. Is called which is in a table named JOB DATES 2. Is called which is in a table called SHIP LOGS I need >,<, and = to the ship date. PLEASE HELP
5
5163
by: DW | last post by:
I have a query in Access 2003 that has the following criteria SELECT tblOrder.SessionDate, tblMenus.Item_Name, tblOrder.Type, Format$(tblorder!SessionDate,"Short Time") AS SessionTime, Sum(tblMenus.Item_Quantity) AS MenuCount INTO tblSessionQuery FROM tblOrder, tblMenus WHERE (((tblOrder.Order_ID)=.) AND ((Format$(!,"mm/dd/yyyy")) Between Format$(!!,"mm/dd/yyyy") And Format$(!!,"mm/dd/yyyy")))
2
2223
by: falroc | last post by:
I have a data base that is used for billing. I have a form called a report selector form. Below is the code used to create the report from the user inputs on the form. What I want to do is add a way for the users to input dates and when they push the intake button they get all the date between the two dates the user/s input. Private Sub cmdIntake_Click() Dim strCountyName As String Dim strAgencyStatus As String Dim...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8891
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.