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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep getting a type mismatch

Status
Not open for further replies.

Tailgun

Technical User
Mar 30, 2002
417
US
Keep getting a type mismatch in the critera in this
--------------------
Select *
FROM tblPayAppLineItems INNER JOIN tblProjectLineItems
ON tblPayAppLineItems.LineItemID = tblProjectLineItems.LineItemID WHERE tblPayAppLineItems.payappID = '" & CLng(frmPayApp.Text1.Text) & "'
----------------------------
both payappID and Text1.Text are numeric long

Sure hope someone can help me

Thanks
 
You don't put the single quote around numeric values in the SQL statement.
 
You could also try using Val instead of CLNG !!

nick
 
Val Would be better! Have you tried putting your SQL back into Access, change critera were needed to see if if works?
 
Couldn't seem to get it to work any of those ways so took out the WHERE and used a recordset.filter instead for some reason that works.

Thanks to all for your help.
 
There was nothing wrong with the WHERE clause if you had the types right, thats where the single quotes shouldn't have been.

For future reference I find it helps to copy the SQL statement I'm trying to execute from a debug window in VB and execute it in Query Analyzer. You get more detailed info on what is wrong.
 
Thanks rdroske I will for sure do that in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top