runtime error13 type mismatch

aman

Registered User.
Local time
Today, 05:26
Joined
Oct 16, 2008
Messages
1,251
Hi guys

I am getting the error at the following line marked red.

Code:
Dim db As Database
        Dim rs As Recordset
        Dim strsql As String
        Dim RecordsDetailsForThis_P2PRequestID As String
        RecordsDetailsForThis_P2PRequestID = ""
        
        strsql = "SELECT location FROM completed_table where barcodevalue<>'' AND BARCODEVALUE='" & Text0 & "'"
        
        Set db = CurrentDb
        [COLOR=red]Set rs = db.OpenRecordset(strsql, dbOpenSnapshot)
[/COLOR]        
        If rs.EOF = True Then
             
            RecordsDetailsForThis_P2PRequestID = ""
        Else
            
            RecordsDetailsForThis_P2PRequestID = "ABC"
                                                
        End If
        
        rs.Close
        Set rs = Nothing
        Set db = Nothing

I hope anyone can help me in this.

Thanks
 
It has text datatype.

Thanks
 
Try this to make sure the SQL statement is actually what you expect it to be:

Code:
msgbox "SELECT location FROM completed_table where barcodevalue<>'' AND BARCODEVALUE='" & Text0 & "'"
 
Yes the sql statement is right but can't figure out why the error message is coming.

Or can you please tell me the alternative to search for a value from the access table and if the value is verified then display"Verified" and if the value is not present in the database then display "Not verified"

Thanks
 
I have used the dcount function and it is working fine. Anyway thanks a lot.
 

Users who are viewing this thread

Back
Top Bottom