I am having a heck of a time trying to figure out what is wrong with this code. Trying to compare a system date with a date in an Access DB using a user defined date.
Initially, I had the compare in the Select Statement and then moved it into a Do While loop as a further test.
The results I am getting is as though the compare is only seeing the Month and Day and not the year. I am able to get the return of anything after today until 12/31/08.
Thanks for your help.
johnc
Anyone see anything wrong with these statements?
SQL statement version:
Code:
Command.CommandText = "SELECT PageIndex FROM CustomerPicks_Reviews WHERE (ItemNumber = '" & intItemNum & "') AND (ExpirationDate >= '" & Format(System.DateTime.Now, "MM-dd-yy") & "')"
Loop version:
Code:
DataReaderIndex = CommandIndex.ExecuteReader()
Do While (DataReaderIndex.Read())
strExpirationDateDB = DataReaderIndex.GetValue(1).ToString
MsgBox(strExpirationDateDB)
If DataReaderIndex.GetValue(1).ToString >= Format(System.DateTime.Now, "MM-dd-yy").ToString Then
CmbBxSglOthIpsPage.Items.Add(DataReaderIndex.GetValue(0))
End If
Loop