I am trying to retrieve the number of records from an Excel spreadsheet that have a datefield value >= a given date from my
VB 2005 Express application. However, I haven't been able to retrieve the correct number of records - it is either all or nothing. It seems to be a date formatting problem between Excel and
VB?
The relevant code I am using is as follows:
strDate = FormatDateTime(dtpreviousday, DateFormat.ShortDate)
rsDataSQL = "Select * from ['CBS InTransit Report$'] WHERE (ETD>='" & strDate & "') AND (location='Complete')"
rsData.Open(rsdataSQL, cnxn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText)
dtpreviousday is the start of the current week (Sunday) and I want to retrieve the number of records that have an ETD of that date or later by using rsdata.recordcount on the resulting recordset.
I will be grateful for any help.