Date w/ Access & SQL Server

S

Sash

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?
 
R

RoyVidar

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
 
Top