troubleshooting Question

Data Type error in ADO Code

Avatar of Takamine334
Takamine334Flag for United States of America asked on
Visual Basic Classic
2 Comments1 Solution187 ViewsLast Modified:
Why am I getting a "Data Type Mismatch in criteria expression" on this line?

Set rs = Myconn.Execute("SELECT * FROM " & SaveDBName & " WHERE ID='" & List1.Text & "'")



It comes from this code:

Dim rs As ADODB.Recordset

    Set rs = Myconn.Execute("SELECT * FROM " & SaveDBName & " WHERE ID='" & List1.Text & "'")
    If rs.EOF Then
        Myconn.Execute "INSERT INTO " & SaveDBName & " (ID) VALUES ('" & List1.Text & "')"
    End If
        rs.Close
        Set rs = Nothing
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros