A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Month-to-date



 
 
Thread Tools Display Modes
  #11  
Old December 1st, 2009, 03:08 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Month-to-date


Use criteria like the following against your date field to report the current
month:
Between DateSerial(Year(Date()),Month(Date()),1)
and DateSerial(Year(Date()),Month(Date())+1,0)

If you wish you can simplify that a bit to
Between DateSerial(Year(Date()),Month(Date()),1) and Date()

Either of the above will give you the desired results unless your date field
contains a date and time. In that case, you will drop the last day's events
unless the event occurred at exactly midnight.

If that is the case then you need criteria like:
= DateSerial(Year(Date()),Month(Date()),1)

and DateSerial(Year(Date()),Month(Date())+1,1)


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

karim wrote:
Daryl
Thanks for the fast replay. I don't know how to restrict the date criteria
to show the monthly result without me going in and changing it every month.
The data I have is date, type of incident, notes. So what I'm trying to do is
for the month of November, when you open the dashboard, it shows you have 10
near miss, and 2 accidents. then when it's December, you go it and it shows 1
near miss and 0 accidents...and so on....

Thanks.

"Daryl S" wrote:

Karim -

If you have a date field as part of your data, then you can write a query to
restrict the result set to any date criteria you wish. If you need more
help, you will need to post more information, like what data you have and how
the calculations should work.

--
Daryl S


"karim" wrote:

Hello All,
I am working on a safety database and I was asked to make a dashboard that
shows all near misses for the month. My question is, is there a way to make
the qry calculate the near misses on the current month only?

Thanks for all the help.

  #12  
Old December 1st, 2009, 04:38 PM posted to microsoft.public.access
Karim
external usenet poster
 
Posts: 68
Default Month-to-date


Thank you all for the help, all great info.

I am not trying to calculate the near misses, I am trying to find the near
misses in the current month. The way Al menssioned does work great, but I
want the form to do the calculation by itself when it is opened. I don't want
the user to type dates or anything. They just open the form and there would
be a label saying "Month-to-Date near miss" and it updates the number of the
near misses as we go. but then when a new month comes, on the 1st there would
be "0" near misses.

Thank you all.
  #13  
Old December 1st, 2009, 04:38 PM posted to microsoft.public.access
Karim
external usenet poster
 
Posts: 68
Default Month-to-date


Thank you all for the help, all great info.

I am not trying to calculate the near misses, I am trying to find the near
misses in the current month. The way Al menssioned does work great, but I
want the form to do the calculation by itself when it is opened. I don't want
the user to type dates or anything. They just open the form and there would
be a label saying "Month-to-Date near miss" and it updates the number of the
near misses as we go. but then when a new month comes, on the 1st there would
be "0" near misses.

Thank you all.
  #14  
Old December 1st, 2009, 04:38 PM posted to microsoft.public.access
Karim
external usenet poster
 
Posts: 68
Default Month-to-date


Thank you all for the help, all great info.

I am not trying to calculate the near misses, I am trying to find the near
misses in the current month. The way Al menssioned does work great, but I
want the form to do the calculation by itself when it is opened. I don't want
the user to type dates or anything. They just open the form and there would
be a label saying "Month-to-Date near miss" and it updates the number of the
near misses as we go. but then when a new month comes, on the 1st there would
be "0" near misses.

Thank you all.
  #15  
Old December 1st, 2009, 04:41 PM posted to microsoft.public.access
Karim
external usenet poster
 
Posts: 68
Default Month-to-date

in another way:

Month To Date: = DateSerial(Year(Date()), Month(Date()), 1)


This code is what I need, but it's not working in the criteria...
  #16  
Old December 1st, 2009, 04:41 PM posted to microsoft.public.access
Karim
external usenet poster
 
Posts: 68
Default Month-to-date

in another way:

Month To Date: = DateSerial(Year(Date()), Month(Date()), 1)


This code is what I need, but it's not working in the criteria...
  #17  
Old December 1st, 2009, 04:41 PM posted to microsoft.public.access
Karim
external usenet poster
 
Posts: 68
Default Month-to-date

in another way:

Month To Date: = DateSerial(Year(Date()), Month(Date()), 1)


This code is what I need, but it's not working in the criteria...
  #18  
Old December 1st, 2009, 05:21 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Month-to-date

On Tue, 1 Dec 2009 08:41:01 -0800, karim
wrote:

in another way:

Month To Date: = DateSerial(Year(Date()), Month(Date()), 1)


This code is what I need, but it's not working in the criteria...


You should not be putting this expression as a calculated field, but instead
as a criterion on the Criteria line under the date field in your table.

--

John W. Vinson [MVP]
  #19  
Old December 1st, 2009, 05:21 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Month-to-date

On Tue, 1 Dec 2009 08:41:01 -0800, karim
wrote:

in another way:

Month To Date: = DateSerial(Year(Date()), Month(Date()), 1)


This code is what I need, but it's not working in the criteria...


You should not be putting this expression as a calculated field, but instead
as a criterion on the Criteria line under the date field in your table.

--

John W. Vinson [MVP]
  #20  
Old December 1st, 2009, 05:21 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Month-to-date

On Tue, 1 Dec 2009 08:41:01 -0800, karim
wrote:

in another way:

Month To Date: = DateSerial(Year(Date()), Month(Date()), 1)


This code is what I need, but it's not working in the criteria...


You should not be putting this expression as a calculated field, but instead
as a criterion on the Criteria line under the date field in your table.

--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.