DataType mismatch in criteria expression Access 2007 - VBA
-
Dear Alll, i have the following: Set t = classdb.OpenRecordset("select unit_price from contract_details where item_classification_id = '" & Me.Text12.Value & "'";) when it runs it give me this error : DataType mismatch in criteria expression but the item_classification_id is a number feild (using access 2007), and Me.text12.value returns an integer. i have checked it 100's of time, it drives crazy... may be am missing a thing , am not that good in coding, any clues ??? Regards.
0 will always beats the 1.
-
Dear Alll, i have the following: Set t = classdb.OpenRecordset("select unit_price from contract_details where item_classification_id = '" & Me.Text12.Value & "'";) when it runs it give me this error : DataType mismatch in criteria expression but the item_classification_id is a number feild (using access 2007), and Me.text12.value returns an integer. i have checked it 100's of time, it drives crazy... may be am missing a thing , am not that good in coding, any clues ??? Regards.
0 will always beats the 1.
You are enclosing the value obtained from the Text12 textbox in single quotes. That's correct for a text value but not for a numeric value - hence your data mismatch error. Modify your query as follows:
Set t = classdb.OpenRecordset("select unit_price from contract_details where item_classification_id = " & Me.Text12.Value & ";")
-
You are enclosing the value obtained from the Text12 textbox in single quotes. That's correct for a text value but not for a numeric value - hence your data mismatch error. Modify your query as follows:
Set t = classdb.OpenRecordset("select unit_price from contract_details where item_classification_id = " & Me.Text12.Value & ";")
thanks aloooooot regards,
0 will always beats the 1.