code_junkie

Access: Runtime error 13 type mismatch

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. Sub plausibilitaet_check()
  2.  
  3. Dim rs As DAO.Recordset
  4. Dim rs2 As ADODB.Recordset
  5. Dim db As database
  6. Dim strsql As String
  7. Dim strsql2 As String
  8. Dim tdf As TableDef
  9.  
  10.  
  11.  
  12.  
  13. Set db = opendatabase("C:Codebook.mdb")
  14. Set rs = db.OpenRecordset("plausen1")
  15.  
  16. Set rs2 = CreateObject("ADODB.Recordset")
  17. rs2.ActiveConnection = CurrentProject.Connection
  18.  
  19.  
  20. For Each tdf In CurrentDb.TableDefs
  21.  
  22. If Left(tdf.Name, 4) <> "MSys" Then
  23. rs.MoveFirst
  24. strsql = "SELECT * From [" & tdf.Name & "] WHERE "
  25.  
  26.  
  27.  
  28. Do While Not rs.EOF
  29. On Error Resume Next
  30.  
  31. strsql2 = "select * from table where GHds <> 0"
  32. Set rs2 = CurrentDb.OpenRecordset(strsql2)
  33.  
  34. Sub plausibilitaet_check()
  35.  
  36. Dim rs As DAO.Recordset
  37. Dim rs2 As DAO.Recordset
  38. Dim db As database
  39. Dim strsql As String
  40. Dim strsql2 As String
  41. Dim tdf As TableDef
  42.  
  43. Set db = opendatabase("C:Codebook.mdb")
  44. Set rs = db.OpenRecordset("plausen1")
  45.  
  46.  
  47. For Each tdf In CurrentDb.TableDefs
  48.  
  49. If Left(tdf.Name, 4) <> "MSys" Then
  50. rs.MoveFirst
  51. strsql = "SELECT * From [" & tdf.Name & "] WHERE "
  52.  
  53. Do While Not rs.EOF
  54. On Error Resume Next
  55.  
  56. strsql2 = "select * from table where GHds <> 0"
  57. Set rs2 = CurrentDb.OpenRecordset(strsql2)
Add Comment
Please, Sign In to add comment