count only those after a certain date

L

Lila

I am trying to count how many properties sold after a certain date. So far I
have the following in the "field" area of the query

sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],0))

....but it returns the total number of fields, not just the ones sold after
the given date.

Then I tried just putting the field name in the field area Info_SaleDate and
putting the date in the criteria
10/31/2003, but it returned some inexplicable number that was obviously
wrong. When the pound sign was in the criteria, the entire form was blank.

Help!
 
G

Guest

Is your [Info_SaleDate] field a datatype of datetime or a text field? Open
the table in design view to check.

Lila said:
I am trying to count how many properties sold after a certain date. So far I
have the following in the "field" area of the query

sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],0))

....but it returns the total number of fields, not just the ones sold after
the given date.

Then I tried just putting the field name in the field area Info_SaleDate and
putting the date in the criteria
10/31/2003, but it returned some inexplicable number that was obviously
wrong. When the pound sign was in the criteria, the entire form was blank.

Help!
 
L

Lila

It is Date/Time

KARL DEWEY said:
Is your [Info_SaleDate] field a datatype of datetime or a text field? Open
the table in design view to check.

Lila said:
I am trying to count how many properties sold after a certain date. So far I
have the following in the "field" area of the query

sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],0))

....but it returns the total number of fields, not just the ones sold after
the given date.

Then I tried just putting the field name in the field area Info_SaleDate and
putting the date in the criteria
10/31/2003, but it returned some inexplicable number that was obviously
wrong. When the pound sign was in the criteria, the entire form was blank.

Help!
 
J

John Spencer

Count counts the presence of a value. It doesn't count nulls so, try this

Sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],NULL))


Lila said:
I am trying to count how many properties sold after a certain date. So far
I
have the following in the "field" area of the query

sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],0))

...but it returns the total number of fields, not just the ones sold after
the given date.

Then I tried just putting the field name in the field area Info_SaleDate
and
putting the date in the criteria
10/31/2003, but it returned some inexplicable number that was obviously
wrong. When the pound sign was in the criteria, the entire form was blank.

Help!
 
L

Lila

Perfect! I was trying to do that with the 0... I even tried "", but for some
reason I didn't think of NULL. Too much Excel I guess.

Lila

John Spencer said:
Count counts the presence of a value. It doesn't count nulls so, try this

Sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],NULL))


Lila said:
I am trying to count how many properties sold after a certain date. So far
I
have the following in the "field" area of the query

sold: Count(IIf([Info_SaleDate]>#10/31/2003#,[Info_SaleDate],0))

...but it returns the total number of fields, not just the ones sold after
the given date.

Then I tried just putting the field name in the field area Info_SaleDate
and
putting the date in the criteria
10/31/2003, but it returned some inexplicable number that was obviously
wrong. When the pound sign was in the criteria, the entire form was blank.

Help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

between two dates 2
list a field based on a date 5
Retrieve data after a certain date 5
date count 4
Parameter Query 2
Countif on qry 6
Count date only one time per occurance 4
age groups 6

Top