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

Error trying to search a database table

Status
Not open for further replies.

pandu101

MIS
Sep 20, 2010
17
US
I am trying to run the following query that will look for events with a particular date in a table. The date is saved as a string in the database (SQL 2005). But I get an error stating "Incorrect syntax near 'Sunday" on the following line (the second one).

Code:
start_date = "Job started: Sunday, September 26, 2010 at 11:00:03 AM"

objRS.Open "SELECT * FROM tbl_Backup_Jobs WHERE start_date = "&start_date,objConn,3,3

I cant figure out how to get around this error. TIA.
 
Code:
objRS.Open "SELECT * FROM tbl_Backup_Jobs WHERE start_date = '" & start_date & "'",objConn,3,3

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top