2nd Post on VB Coding for Count by Month

L

Lin

I need extensive help on this in laymens terms.
I have a form that I use to create a file on a child admission.
I need to count how many children were admitted for a month and display on
the form. I tried various codes and they do not work. I am probably doing
it wrong.
So basically, when staff admit a new child, they see the date, beside the
date I would like a text box to show what count we are at for the month. The
count would need to be reset to Zero each month. Is there a simple way?????


Please help.

Thanks in advance.....
 
J

John Vinson

So basically, when staff admit a new child, they see the date, beside the
date I would like a text box to show what count we are at for the month. The
count would need to be reset to Zero each month. Is there a simple way?????

Yes.

Set the Control Source of the textbox to

=DCount("*", "<some table name that you have not told us>",
"[datefield] >= #" & DateSerial(Year(Date()), Month(Date()), 1) & "#")

where datefield is the field in the table indicating the date of
admission.

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