how do i deal with the error "DATA TYPE MISMATCH IN CRITERIA EXPRESSION" in VB6?
dataExam.RecordSource = "SELECT [exam score] FROM exams WHERE [Sctr] = '" & DataStudandClass.Recordset(0).value & "' AND [Cctr] = '" & DataStudandClass.Recordset(1).value & "'"
dataExam.Refresh 'when i click debug, this line is highlighted
Both Sctr and Cctr are autoNumbers...
- Special EdLv 51 decade agoBest Answer
You need to check the datatypes for [Sctr] and [Cctr] and verify that you are plugging in the right data type. It is hard to give you a solution without seeing the types of the table.
Are you using single quotes for the numbers? It is kind of hard to tell here. Do not use single quotes or double quotes for numeric values. Just a thought.
- launerLv 43 years ago
it is traditionally a bother along with your the placement clause. you're announcing "the place 'something' equals 'some element else'. those 2 values must be on the instant comparable, the two provided that they are the comparable documents type (e.G. each and each numbers), or they're close enogh for an implicit conversion. Double ensure your total '=' and ensure the two gadgets are the equivalent documents form.
- christnpLv 71 decade ago
It's probably a problem with your WHERE clause. You are saying "Where 'something' equals 'something else'. Those two values need to be directly comparable, either because they are the same data type (e.g. both numbers), or they are close enogh for an implicit conversion.
Double check all of your '=' and make sure the two items are the same data type.