Click to See Complete Forum and Search --> : [RESOLVED] Microsoft VBScript runtime error '800a000d' Should be simple, Please Help?!


NickG21
05-26-2009, 10:19 AM
Hey Everyone,
I'm receiving this error with the Type mismatch: 'CDate' on the following line of code;

if Cdate(FillDate) <> Cdate(FirstFillDate) then

This line is comparing these two dates, if there is more than one "item" or "FillDate" in the list. Here is the code that surrounds this line;

'Determine if we need to list fill dates separately, each with its item.
dim FillDateList
FillDateList = Join(dictFillDates_Adj.Items, ",")
SepDates = false
if not ShipComplete and InStr(OpIDList, ",") > 0 then
dim FirstFillDate
FirstFillDate = ""
Response.Write(FillDateList & "<br/>")
for each FillDate in Split(FillDateList, ",")
if FirstFillDate = "" then
FirstFillDate = Cdate(FillDate)
Response.Write("FirstFillDate is: " & FirstFillDate & "<br/>")
else
if Cdate(FillDate) <> Cdate(FirstFillDate) then
SepDates = true
exit for
end if
end if
next
end if

Also, here is what is displayed with the debugging using response.write();

6/1/2009,6/1/2009,
FirstFillDate is: 6/1/2009

as you can see prior to the FirstFillDate variable being set to 6/1/2009, the values of both FillDate variables are already equal, which would seem to me that when the if Cdate(FillDate) <> Cdate(FirstFillDate) then line of code is hit, the condition should be true and not return an error. Does anyone have an idea why this is happening?
Thank you in advance,
Nick