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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Monthly data based on dates



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2009, 11:26 AM posted to microsoft.public.access.queries
cf
external usenet poster
 
Posts: 10
Default Monthly data based on dates

Hello,

I am new to Access and trying to get an employee database. Now, I like to
have a query/report (that I can afterwards download to excel) that tells me
if a person was in the company during a certain month or not - based on the
start date and end date. The end date can be empty.

What I am doing now is to have a query for each month that tells me if the
person was in the company or not, with the following calculation:
Jan 09: IIf([Employee]![Start Date]=31/1/2009 And ([Employee]![End
Date]=31/1/2009 Or [Employee]![End Date]=""),1,0)

However this doesn't give the desired result. Any suggestion?

Thanks.
  #2  
Old May 27th, 2009, 01:21 PM posted to microsoft.public.access.queries
Ken Snell [MVP]
external usenet poster
 
Posts: 279
Default Monthly data based on dates

Try this -- Use Nz function to replace a NULL date in your table with
today's date (or you can use any other date you wish), and change your date
format to the US version (which is how ACCESS will interpret dates in a
x/x/yyyy format), and delimit the dates with # characters:

Jan 09: IIf([Employee]![Start Date]=#1/31/2009# And Nz([Employee]![End
Date], Date())=#1/31/2009#,1,0)

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/



"CF" wrote in message
...
Hello,

I am new to Access and trying to get an employee database. Now, I like to
have a query/report (that I can afterwards download to excel) that tells
me
if a person was in the company during a certain month or not - based on
the
start date and end date. The end date can be empty.

What I am doing now is to have a query for each month that tells me if the
person was in the company or not, with the following calculation:
Jan 09: IIf([Employee]![Start Date]=31/1/2009 And ([Employee]![End
Date]=31/1/2009 Or [Employee]![End Date]=""),1,0)

However this doesn't give the desired result. Any suggestion?

Thanks.



  #3  
Old May 27th, 2009, 03:25 PM posted to microsoft.public.access.queries
cf
external usenet poster
 
Posts: 10
Default Monthly data based on dates

Great - this works fine.

Thanks a lot.

"Ken Snell [MVP]" wrote:

Try this -- Use Nz function to replace a NULL date in your table with
today's date (or you can use any other date you wish), and change your date
format to the US version (which is how ACCESS will interpret dates in a
x/x/yyyy format), and delimit the dates with # characters:

Jan 09: IIf([Employee]![Start Date]=#1/31/2009# And Nz([Employee]![End
Date], Date())=#1/31/2009#,1,0)

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/



"CF" wrote in message
...
Hello,

I am new to Access and trying to get an employee database. Now, I like to
have a query/report (that I can afterwards download to excel) that tells
me
if a person was in the company during a certain month or not - based on
the
start date and end date. The end date can be empty.

What I am doing now is to have a query for each month that tells me if the
person was in the company or not, with the following calculation:
Jan 09: IIf([Employee]![Start Date]=31/1/2009 And ([Employee]![End
Date]=31/1/2009 Or [Employee]![End Date]=""),1,0)

However this doesn't give the desired result. Any suggestion?

Thanks.




 




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 02:17 AM.


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