Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Date Issue

Status
Not open for further replies.

Ebes1099

Technical User
Jul 8, 2009
156
US
I want to write a query to look at a table and only return values within a specific date range. I see this is easy to do if you just enter the date range specifically. I have a date field and I need the records that have start dates between 7/31/2009 to 8/1/2010. If I wanted to just hard code those dates in it works great. My problem is this database is going to be used many years and I don't want to have to go change that field every year. I have another value in a different table called BudgetYear that I want to reference in this query. So my Criteria would be something like

Between 7/31/Year(BudgetYear)-1 And 8/1/Year(BudgetYear). But that doesn't work. Anyone know how I can do this?
 



Hi,
Code:
Between DateSerial(BudgetYear-1,8,0) And DateSerial(BudgetYear,8,1)



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top