Hi,
I have an access db that I am trying to query from a vb6 program. I've the following code:
Dim sSQLQuery As String
sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID & Chr(39)
ID here is equal to 1234567890
MsgBox sSQLQuery
the msgbox says: SELECT * FROM TblData WHERE ID = '1234567890 Note that the quotation is missing at the end
Set rs = db.OpenRecordse t(sSQLQuery, dbOpenDynaset)
Here I get the error:
Run-time error '3075'
Syntax error in string in query expression 'ID='1234567890 '.
Note that now there's a single quotes before ID (+ where's the rest of the sql string).
As a note, ID is not a numeric field in the access database. Its in as a text-field. Now here's the biggie: this code works for me in my development PC and the query returns with the data in the db. This started happening on another laptop that I installed this application on all of a sudden and I am unable to reproduce this on my PC.
Any help is appreciated.
I have an access db that I am trying to query from a vb6 program. I've the following code:
Dim sSQLQuery As String
sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID & Chr(39)
ID here is equal to 1234567890
MsgBox sSQLQuery
the msgbox says: SELECT * FROM TblData WHERE ID = '1234567890 Note that the quotation is missing at the end
Set rs = db.OpenRecordse t(sSQLQuery, dbOpenDynaset)
Here I get the error:
Run-time error '3075'
Syntax error in string in query expression 'ID='1234567890 '.
Note that now there's a single quotes before ID (+ where's the rest of the sql string).
As a note, ID is not a numeric field in the access database. Its in as a text-field. Now here's the biggie: this code works for me in my development PC and the query returns with the data in the db. This started happening on another laptop that I installed this application on all of a sudden and I am unable to reproduce this on my PC.
Any help is appreciated.
Comment