![]() |
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 |
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 |
All times are GMT +1. The time now is 10:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com