Trouble with Date and Time SQL Passthrough Update

J

Joey

Hi All,

I'm having problems updating a date/time field for a record on a table
on a SQL Server via an SQL Passthrough statement. I set my statement to
this

strSQL = "UPDATE tbl SET dtm_updated = #" & Now & "# WHERE int_tbl_id =
12345;"

And I get an ODBC Call Failed Error.

It works if I set the dtm_update = NULL so I'm wondering if there is
some date/time conversion issue with Access97 and SQL Server. How and
what format do I need to convert the date/time so that I can update the
SQL Server table?

Thanks,
Joey.
 
D

Douglas J. Steele

SQL Server doesn't use # to delimit dates: it uses '.

Try:

strSQL = "UPDATE tbl SET dtm_updated = '" & Format(Now, "yyyy-mm-dd
hh:nn:ss") & "' WHERE int_tbl_id = 12345;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top