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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|