Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB-SQL error Data Type mismatch in criteria

Status
Not open for further replies.

nhb

Programmer
Jul 8, 2000
6
0
0
MY
I have a db created in access with a table<br>that has a list of fields. I assign a primary key to field (FieldA) that is a numeric-long data type.<br><br>I try to open the query using this command<br>DataEnvironment.rsTblTest.Open _<br>&quot;Select * from tblTest Where FieldA Between '&quot; + lngFldA + &quot;'&quot;<br><br>where lngFldA = cLng(txtFldA.Text)<br>It gives me the error mentioned above.<br><br>Please help...
 
Are you using the keyword Between alone?<br>A correct syntax might be :<br>SELECT * <br>FROM TblTest<br>WHERE FieldA BETWEEN &quot; + lngFldA + &quot; AND &quot; + AnotherLng + &quot;;<br><br>for example<br><br>ZIL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top