Thread: DCOUNT
View Single Post
  #3  
Old August 23rd, 2009, 05:44 AM posted to microsoft.public.access.gettingstarted
ghostman via AccessMonster.com
external usenet poster
 
Posts: 45
Default DCOUNT

Perfect!!

thank you very much!


John Spencer wrote:
For the current month, you can use the following expression:
DCOUNT("TSID","[Training Sessions]","SessionDate between
DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())+1,0)")

For Last Month the third argument would be
"SessionDate between DateSerial(Year(Date()),Month(Date())-1,1) And
DateSerial(Year(Date()),Month(Date())+1-1,0)"

The expression
DateSerial(Year(Date()),Month(Date())+1,0)
returns the last day of the month. It helps to think of this as
DateSerial(Year(Date()),Month(Date())+1,1) -1
which can be expressed as
DateSerial(Year(Date()),Month(Date())+1,1-1)
and 1-1 is zero.

'================================================ ====
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'================================================ ====

i have this DCOUNT formula on a text box which counts number of training
sessions in my record. The text box is in my main form.

[quoted text clipped - 12 lines]
counting YTD, i can't get the THIS MONTH work - showing errors!)
Thanks.


--
Message posted via http://www.accessmonster.com