Ciao a tutti.

Questo codice funziona in access, mentre con mysql restituisce:

Tipo di errore:
Errore di run-time di Microsoft VBScript (0x800A000D)
Tipo non corrispondente

sulla riga segnata in rosso, dove sbaglio:?

codice:
strSQL = "select DueDate, Count(*) as Total, MAX(LastModified) as Latest from message where Month(DueDate)= " _
	    &Month(dtSelected) &" and Year(DueDate) = " &Year(dtSelected) _
	    &" group by DueDate order by DueDate DESC"

 set objREC = cn.Execute(strSQL)	    
	    	    

	    Redim aMessageDate(0)

	    arrIndex = 0 
	    
	    Do While NOT objREC.EOF 	       
	       arrIndex = arrIndex + 1 
	       Redim Preserve aMessageDate(arrIndex)
	      objREC.MoveNext
	    Loop



For J= 0 to UBOUND(aMessageDate)-1 
        
        DatePlus7 = CDate(dateadd("d", -7,NOW))
        DatePlus14 = CDate(dateadd("d", -14,NOW))
        
           If CDate(aMessageStatus(J)) >= DatePlus7 then 
              strDateIMG = ""
           end if 
        
              if aMessages(J) >= 25 then    
                 strDateIMG = "Warning"
               else
                 strDateIMG = ""
              end if

Next