Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dates in SQL query won't match
I'm importing data from Access into Excel. At one point, I need to import dates, and for some reason they don't match.
month = CDate(Cells(1, iCol)) .... Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Occupancy WHERE [Month] = " & month, cn, adOpenKeyset, adLockOptimistic I have 3 records in Occupancy where Month is 2008-04-01. When the month variable is also 2008-04-01, I still get 0 on rs.RecordCount! The month is stored as a Date/Time (short date) in Access. I also tried WHERE [Month] = " & Format(month, "yyyy-mm-dd") Still no success. Gustaf |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dates in SQL query won't match
Gustaf wrote:
I'm importing data from Access into Excel. At one point, I need to import dates, and for some reason they don't match. Found it. I need to write WHERE [Month] = #" & month & "#" Gustaf |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Index, match, multiple IFs query | Excel Worksheet Functions | |||
How to list the rows that match a particular query? | Excel Discussion (Misc queries) | |||
Text match from web query | Excel Discussion (Misc queries) | |||
index and match query | Excel Worksheet Functions | |||
INDEX AND MATCH QUERY ? | Excel Worksheet Functions |