Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

Searching for dates in SQL 2005

$
0
0
Hi everyone.
I am trying to write a macro in vb6 where I find records between 2 specific dates. The database I am using is SQL server 2005. The field that will contain the dates uses a datetime data type. In Access this would be easy. Unfortunately, with SQL I cannot do it.
My code looks like:

recordset.open "Select * from [table searched] WHERE [specificdatefield] BETWEEN #" & format(startdate,"MM/dd/yyyy) & "# AND #" & format(startdate,"MM/dd/yyyy) & "#".

This would work with an Access database.

Any help would be greatly appreciated.

Tim Christopher

Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>