simple code error on openRecordset cmd

J

jeff moore

every thing works right up to the last statment, where i
get a "Data type mismatch in criteria expresion" error.
run time error 3464. I have all the nessecary dao libaries
enabled. the code is identical to code in a different
database that does run. the SQL query runs fine on its
own. the var prodcode = 11166 and the SQL statement
returns SYCAMORE. TIA Jeff

Dim db As Database
Dim SQL As String
Dim rs As Recordset
Set db = CurrentDb()
Dim Prodcode As String
Prodcode = Me![WFCProdCode].Text
MsgBox Prodcode
SQL = "SELECT [Product].[CustAbrev]FROM Product WHERE
((([Product].[ProdCode])='" & Me![WFCProdCode].Text
& "'));"
MsgBox SQL
Set rs = db.OpenRecordset(SQL)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top