Convert String to Date Problem in SQL statement.

kosala1981

New member
Local time
Today, 13:56
Joined
Apr 5, 2007
Messages
9
In the following statement i tried to send BeginningDate(textbox value) and EndingDate(txtbox value) to the SQL stmnt but it gave an error saying "Type Mismatch" even though i used CDate method. answer for this problem is greatly appreciated......:(

"WHERE Project.tProjTitle='" + Trim(cboProjectTitle) + "' AND Project.nProjId=Indicator.nProjId AND Indicator.tIndicatorName='" + cboIndicator + "' AND Indicator.nIndicatorId=IndicatorData.nIndicatorId AND Region.nRegionId=IndicatorData.nRegionId AND Institute.nInstituteId=IndicatorData.nInstituteId AND" + _
"IndicatorData.EndingDate Between '" + CDate(BeginningDate) + "' AND '" + CDate(EndingDate) + "' " + _"GROUP BY IndicatorData.nRegionId, " + Trim(Replace(cboRows, "_", ".")) + " "
 
use the concatenation operator & and not plus + for strings
 
And put CDate() inside the double-quotes:

"IndicatorData.EndingDate Between CDate('" & BeginningDate & "') AND CDate('" & EndingDate & "') " & _
.
 

Users who are viewing this thread

Back
Top Bottom