
SQL parameter type problem
I am trying to delete a record in an Access table by referencing its
autonumber field [RecID].
It returns run time error 13: type mismatch. I've tried changing the data
types with no luck. The puzzling thing is that if the variable is replaced
with an integer in the SQL statement all is OK.
Dim sRecNum As Long 'I've tried Long Integer even tried changing data
type in table
sRecNum = 99
Set MyWS = DBEngine.Workspaces(0)
Set MyDb =
Workspaces(0).OpenDatabase("c:\htroot\cgi-win\Eric\database1.mdb")
MySQLdel_rec = "DELETE * FROM records WHERE [RecID] = '" & sRecNum & "'"
'this one doesn't
MySQLdel_rec = "DELETE * FROM records WHERE [RecID] LIKE 99" 'this one
works
MyDb.Execute MySQLdel_rec, dbFailOnError
MyDb.Close
Any help, be email would be appreciated.
TIA
Eric Givens