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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range +- of todays date

Status
Not open for further replies.

meltingpot

Technical User
May 11, 2004
118
GB
Simple Code

SELECT CourseName
FROM Courselist
WHERE CourseName='First Aid' Between#StartDate# AND #EndDate#

There are many First Aid courses that run at random times across the month.

I want to be able to find 'First Aid' courses that are running today and show any running 8 days +- of todays date... Any ides

:)
 



Hi,
Code:
WHERE CourseName='First Aid' [b] 
  AND [YourDateField] Between Date{}-8 AND Date()+8[/b]


Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Ive tried but get a syntax error in expression.

BTW - the query is running on an ASP web page connecting to an Access database.

Code I tried ..StartDate is the date field in tbl CourseList
SELECT *
FROM Courselist
WHERE CourseName='First Aid' AND StartDate Between Date{}-8 AND Date()+8

What have I done ????? :)

Do I need # some where ?
 



check out the [red]BRACES[/red] you have rather than PARENTHESES...
Code:
WHERE CourseName='First Aid' AND StartDate Between Date[red][b]{}[/b][/red]-8 AND Date()+8

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Changed the Braces get error 'too few parameters.Expected 1'

Code Used .....
WHERE CourseName='First Aid' AND StartDate BETWEEN Date()-8 AND Date()+8

:)
 
Its working - retyped it all in again, closed the program and it worked fine - Program bug ???

Thanks for the help
:)
 
Nope - wrong brachets {} is not the same as ()

!
 
Hi see Thru ... the odd thing is it is working great with () ???

Check out 'Courses Running This Week ' on
I used this code
"WHERE StartDate Between Date()-5 AND Date()+5" and was not so happy with Date{} ...

But hey ... it works :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top