Click here to Skip to main content
15,742,323 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone i'm using VB 6.0

and I'm having an error in my sql code.. that is show below..
its always says that Data Type mismatch in criteria expression..

Private Sub Command1_Click()
Adodc1.RecordSource = "select * from Test1 where BDate between BDate >= '" & (Dt1.Value) & "' and BDate <= '" & (Dt2.Value) & "'"
End Sub

Please give me an advice if my format is correct..
Thanks for advance!

1 solution

if the Database is MS ACCESS then use # instead '. Also check the column BDate is date type or not. Your code only works if the column is date type. Otherwise you should use conversions.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900