Count() for Dates

G

Guest

Good morning,

I have a date field and a Count() field on my form. The Count() field will
count the number of records of the date field being populated by the users on
the form.

I use the formula "Count([Date Field])", and it does not seem to work. For
example, I have 10 records on the form. If I enter a date on one of 10
records, the count field would show 1.

Thanks.
 
J

John W. Vinson

Good morning,

I have a date field and a Count() field on my form. The Count() field will
count the number of records of the date field being populated by the users on
the form.

I use the formula "Count([Date Field])", and it does not seem to work. For
example, I have 10 records on the form. If I enter a date on one of 10
records, the count field would show 1.

Thanks.

You're misunderstanding. Count does not count dates. It counts Records, in the
query in which you're using it. If you have Count([any field name]) or
Count(*) as just a calculated field in a query, the result will be 1 - that
very record.

It's not clear what you want to count. Do you want to count all of the records
in the table upon which the form is based? All of the records entered by this
user? all of the records entered by THIS user on THIS form during this
session? If so, what's the recordsource for the form?


John W. Vinson [MVP]
 
G

Guest

Thanks both of you for your responses.

I want the count field to count the records of populated date fields. When
the users enter a date in that date field on a form, it should count as 1.

Now I think it's working. For some reason, it wasn't working when I posted
the message.

Thanks again.

John W. Vinson said:
Good morning,

I have a date field and a Count() field on my form. The Count() field will
count the number of records of the date field being populated by the users on
the form.

I use the formula "Count([Date Field])", and it does not seem to work. For
example, I have 10 records on the form. If I enter a date on one of 10
records, the count field would show 1.

Thanks.

You're misunderstanding. Count does not count dates. It counts Records, in the
query in which you're using it. If you have Count([any field name]) or
Count(*) as just a calculated field in a query, the result will be 1 - that
very record.

It's not clear what you want to count. Do you want to count all of the records
in the table upon which the form is based? All of the records entered by this
user? all of the records entered by THIS user on THIS form during this
session? If so, what's the recordsource for the form?


John W. Vinson [MVP]
 
G

Guest

Count([Date Field])",

=Count("*","RecordSetName","[Date Field] Is Not Null")

--
Dave Hargis, Microsoft Access MVP


Please Help said:
Thanks both of you for your responses.

I want the count field to count the records of populated date fields. When
the users enter a date in that date field on a form, it should count as 1.

Now I think it's working. For some reason, it wasn't working when I posted
the message.

Thanks again.

John W. Vinson said:
Good morning,

I have a date field and a Count() field on my form. The Count() field will
count the number of records of the date field being populated by the users on
the form.

I use the formula "Count([Date Field])", and it does not seem to work. For
example, I have 10 records on the form. If I enter a date on one of 10
records, the count field would show 1.

Thanks.

You're misunderstanding. Count does not count dates. It counts Records, in the
query in which you're using it. If you have Count([any field name]) or
Count(*) as just a calculated field in a query, the result will be 1 - that
very record.

It's not clear what you want to count. Do you want to count all of the records
in the table upon which the form is based? All of the records entered by this
user? all of the records entered by THIS user on THIS form during this
session? If so, what's the recordsource for the form?


John W. Vinson [MVP]
 
J

John W. Vinson

Count([Date Field])",

=Count("*","RecordSetName","[Date Field] Is Not Null")

Typo there, Dave? I think that should be =DCount("*", ...

John W. Vinson [MVP]
 

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

Top