Date w/ Access & SQL Server

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field in a SQL Server table defined as smalldatetime. In my access
database I link to that table and have the following code, but am gettting a
type mismatch.

DoCmd.RunSQL "UPDATE dbo_Anesth SET fldExported = Now() " & _
"WHERE ((dbo_Anesth.fldExported) Is Null) and [ip_opdate] Between #" &
dtStart & "# And #" & dtEnd & "# "

What am I missing?
 
Sash said:
I have a field in a SQL Server table defined as smalldatetime. In my
access database I link to that table and have the following code,
but am gettting a type mismatch.

DoCmd.RunSQL "UPDATE dbo_Anesth SET fldExported = Now() " & _
"WHERE ((dbo_Anesth.fldExported) Is Null) and [ip_opdate] Between
#" & dtStart & "# And #" & dtEnd & "# "

What am I missing?

One possible guess - date format

.... Between #" & format$(dtStart, "yyyy-mm-dd") & "# And #" & _
format$(dtEnd, "yyyy-mm-dd") & "# "

here using ISO 8601
 

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

Back
Top