Bennie47250
Programmer
Using Access version 7.0
I’m working on a query that will run 2 times a year and each time the query run’s it need to extract records for the prior full six months. Using a scheduling tool, I want to schedule the report to run on Jan 5th and July 5 of each year.
When the report runs on 1/5/06, it needs to extract records with an invoice date in the period of 7/1/2005 thru 12/31/2005.
When the query runs on 7/5/2006, it needs to extract records with an invoice date in the period of 1/1/2006 thru 6/30/2006.
I was hoping to use a formula like IIf ( Date () between DateSerial ( Year ( Date () ) , 7, 1) and DateSerial ( Year ( Date () ) , 7, 15) , between DateSerial ( Year ( Date () ) , 1, 1) AND DateSerial ( Year ( Date () ) , 06, 30) , 7/15/05) (7/15/05 was just for testing)
However this did not return any records.
So for testing I took another stab at the formula and used this today: IIf (Date () = #8/8/2005#, Between #1/1/2005# And #6/30/2005#, Between #1/1/2005# And #6/30/2005#)
This did not return any records ether.
If I just use “Between #1/1/2005# And #6/30/2005#” in the invoice date field it does return records
Would appreciate any help developing a formula to do this.
Thanks
I’m working on a query that will run 2 times a year and each time the query run’s it need to extract records for the prior full six months. Using a scheduling tool, I want to schedule the report to run on Jan 5th and July 5 of each year.
When the report runs on 1/5/06, it needs to extract records with an invoice date in the period of 7/1/2005 thru 12/31/2005.
When the query runs on 7/5/2006, it needs to extract records with an invoice date in the period of 1/1/2006 thru 6/30/2006.
I was hoping to use a formula like IIf ( Date () between DateSerial ( Year ( Date () ) , 7, 1) and DateSerial ( Year ( Date () ) , 7, 15) , between DateSerial ( Year ( Date () ) , 1, 1) AND DateSerial ( Year ( Date () ) , 06, 30) , 7/15/05) (7/15/05 was just for testing)
However this did not return any records.
So for testing I took another stab at the formula and used this today: IIf (Date () = #8/8/2005#, Between #1/1/2005# And #6/30/2005#, Between #1/1/2005# And #6/30/2005#)
This did not return any records ether.
If I just use “Between #1/1/2005# And #6/30/2005#” in the invoice date field it does return records
Would appreciate any help developing a formula to do this.
Thanks