Welcome to Windows Help!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Month-to-date

 
   Windows Help (Home) -> Microsoft Access RSS
Next:  Change "Standard Colors" palette defaul..  
Author Message
karim

External


Since: Jan 20, 2009
Posts: 5



(Msg. 1) Posted: Tue Dec 01, 2009 5:55 am
Post subject: Month-to-date
Archived from groups: microsoft>public>access (more info?)

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.

 >> Stay informed about: Month-to-date 
Back to top
Login to vote
Daryl S

External


Since: Oct 19, 2009
Posts: 13



(Msg. 2) Posted: Tue Dec 01, 2009 6:06 am
Post subject: RE: Month-to-date
Archived from groups: per prev. post (more info?)

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.

 >> Stay informed about: Month-to-date 
Back to top
Login to vote
karim

External


Since: Jan 20, 2009
Posts: 5



(Msg. 3) Posted: Tue Dec 01, 2009 6:26 am
Post subject: RE: Month-to-date
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
Al Campagna

External


Since: Nov 26, 2008
Posts: 11



(Msg. 4) Posted: Tue Dec 01, 2009 9:16 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

karim,
Not sure what you mean by "calculate the near misses."
If you mean a Count of all near misses for a date range, then it's just
a matter of creating a Totals query, and setting a date range criteria in
your query... against the field in your table that indicates the date
of each "near miss."

Create a query that counts all the "near misses"... no
matter what date/s...
Then you criteria that query with a changeable date range...
Ex. field...
NearMissDate
>= [Beginning Date] and <= [EndingDate]

With the above criteria, when the query is run, you will be asked
(via an input box) for a [Beginning Date] value. Then you will be asked
for an [Ending Date].
Say you enter 1/1/09 and 2/1/09 in response...
The query should run, and only return a count of "near misses" within
that date range.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
karim

External


Since: Jan 20, 2009
Posts: 5



(Msg. 5) Posted: Tue Dec 01, 2009 9:16 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
karim

External


Since: Jan 20, 2009
Posts: 5



(Msg. 6) Posted: Tue Dec 01, 2009 9:16 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

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...
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
Daryl S

External


Since: Oct 19, 2009
Posts: 13



(Msg. 7) Posted: Tue Dec 01, 2009 9:38 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

Karim -

Can you explain what you mean by 'not working'? Today is the 1st of the
month, so I would expect no results until a near miss for December is added.

Are you getting an error message?
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
karim

External


Since: Jan 20, 2009
Posts: 5



(Msg. 8) Posted: Tue Dec 01, 2009 9:46 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

yes, I am getting an error msg "#Name?"

I also added a record for today just to try it.

Basically what I am doing is I made a form and I have a text box that
suppose to show the totla records in it, but it's giving me that error.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
John Spencer

External


Since: Dec 8, 2008
Posts: 16



(Msg. 9) Posted: Tue Dec 01, 2009 10:08 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
John W. Vinson

External


Since: Nov 28, 2008
Posts: 104



(Msg. 10) Posted: Tue Dec 01, 2009 10:21 am
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
Daryl S

External


Since: Oct 19, 2009
Posts: 13



(Msg. 11) Posted: Tue Dec 01, 2009 12:14 pm
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

Karim -

If you are using a query, can you post the SQL to your query (copy/paste
from the SQL View)? That will help us see what you are doing. I assume
this is the query behind the form?
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
Al Campagna

External


Since: Nov 26, 2008
Posts: 11



(Msg. 12) Posted: Tue Dec 01, 2009 1:39 pm
Post subject: Re: Month-to-date
Archived from groups: per prev. post (more info?)

That's probably due to an element of the calculation referring to an
object name that does not exist.
Given Price and Qty then a calculation like...
Prize * Qty = LineTotal
would yield a #Name? error.
Check the spelling in the calc vs. the real object names.
 >> Stay informed about: Month-to-date 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Number To Month - My field [month] consists of month in number. I've been using this expression to convert number to month name MonthName([Month],True) My problem is i want to display one month after ..say Jan from 12/Dec Hope my explaination is clear

Show Last Month in TextBox? - Trying to show last monthis a text box "Feburary" =Date()-1"M"

Function for previous month and present year - I am looking for a relatively simple function that will give me the previous month (March) and present year (2009). I know the basic formula to get the present month and year =Format(Date(),"mmmm yyyy") But what do I add to make it give me ...

Format Date #/#/# - I am trying to use a function that I have used in the past but for some reason today when I type it in the query field and run my report Access is converting "####/##/##" to #\/#\/# and I receive an error message in that field for my query r...

Date Format - how can i set the date format from 8/30/2009 to August, 2009?? This date is on my subform. any idea?
   Windows Help (Home) -> Microsoft Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]