I tried your solution but am still getting data type missmatch error. here is what I have
-
SELECT ... WHERE " & myfield & " = "& mySchTxt &""
-
I even tried the Cint() function but nothing budges.
Eventhough the error tells me it is a type mismatch the line points to the following codes
- RecordSet.Open cmdDC, , 3, 3
Does this have anything to do with that error? if so what to do.
One last thing. How do I deal with dates
So you got the error, but what is in myfield? What data type is that column? Is it a int or a string?
Dates just use # instead of ' , but sometimes this depends on what database system your using. Most should accept #
So if myfield is a string you use '" & schtxt & "'
if myfield number you use " & schtxt & "
if myfield date you use #" & schtxt & "#
And yes that would be the line that causes the error because that's where your EXECUTING the sql. When you are doing sql = whatever all you are doing is preparing the string