SQL parameter type problem 
Author Message
 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



Sat, 15 Aug 1998 03:00:00 GMT  
 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



Sat, 15 Aug 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL parameter type problem

2. help: SQL parameter type mismatch in report generator

3. Using ADODB.Parameters and SQL Text Data type

4. API parameter type problem - please help!

5. Problem: User-defined types as parameters...

6. Parameter type-mismatch problem calling Java applet from VBScript

7. Parameters and numeric type problem

8. Problems passing DATE type parameter to sub report

9. VB6 - Problem passing multiple parameters to Command SQL statement

10. Problems using Parameters with SQL

11. Problem passing parameters to SQL Server

12. SQL problems when using PARAMETERS...

 

 
Powered by phpBB® Forum Software