HolyRoller
Programmer
Folks,
I have a function being used to return a UPC I'm looking up in another table. When I run it, I get a "type mismatch" error. Can you help me spot the error or give me tips on how to diagnose what the problem is? I'm not sure what is "mismatching", you see. PRODID is defined as a number in the Access Table, and I've tried both LONG and DOUBLE for 'i' below
I have a function being used to return a UPC I'm looking up in another table. When I run it, I get a "type mismatch" error. Can you help me spot the error or give me tips on how to diagnose what the problem is? I'm not sure what is "mismatching", you see. PRODID is defined as a number in the Access Table, and I've tried both LONG and DOUBLE for 'i' below
Code:
Public Function FindUPC(i As Long) As String
Dim DB As Database
Dim rsQueries As Recordset
Dim sqlStr, fUPC As String
Dim index As Long
Set DB = CurrentDb()
sqlStr = "SELECT UPC FROM APP_PRC_PRODUCT_UPC WHERE (PRODID=" & i & ") AND (PRIMARYUPC='Y');"
Set rsQueries = DB.OpenRecordset(sqlStr)
FindUPC = rsQueries!UPC
rsQueries.Close
Set DB = Nothing
End Function