UPDATE query not working with date a value

stringman

Registered User.
Local time
Yesterday, 23:48
Joined
Oct 5, 2006
Messages
24
Hello,

I am having a problem w/ my UPDATE statement when the date value is included in the statement. I have tried surrounding the date variable (strDate) in "#" and w/ and w/out single quotes to no avail. I doesn't matter if I dimension strDate as a string or a date. I know there must be a simple solution. In short, the UPDATE statement looks like this:

Code:
strSQL = "UPDATE tblTasks SET POC = '" & strPOC & "', Date = #" & strDate & "#, Task = '" & strTask & "' WHERE id = " & lID & ";"

If I remove
Code:
Date = #" & strDate & "#,
then the query works.

These also fail:
Code:
Date = #'" & strDate & "'#,
Code:
Date = '#" & strDate & "#',
Code:
Date = '" & strDate & "',

Any help would be greatly appreciated. Thanks.

Ken
 
If your field is really named "Date" then you will drive Access nuts and you need to change the name of the field. Date is a reserved word.
 
Thanks. Problem fixed by placing brackets around the field name in the UPDATE statement. No fileds named Date for me.

Ken
 

Users who are viewing this thread

Back
Top Bottom