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

Select statement and Dateadd

Status
Not open for further replies.

tcapp

Programmer
Apr 18, 2000
9
US
I am trying to select only records for the next seven days. I have added a date in the record using the DTpicker. When using the dateadd function in my SQL statement it gives me a syntax error. Any help is appreciated.

Code:
edate = DateAdd("d", 7, Date)
' set strings
sSQL = "select [Assigned To],ClientID,Comments,DueDate,ProjectTitle,RecordID,Resources,Submittal from HotList where duedate >= '" & edate & "'"
 
What is the error? Is the data type in your database for [duedate] a string or Date/Time? And what database are you using(SQL Server,ORacle,ACCESS)?
 
Thanks I figured it out from a previous post... What I was looking for was

sSQL = "select [Assigned To],ClientID,Comments,DueDate,ProjectTitle,RecordID,Resources,Submittal from HotList where duedate between #" & Date & "# and #" & edate & "#"

I wasnt using the #
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top