Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

type mis-match error 1

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I am getting a type-mismatch error when I try to set my recordset. Any ideas?


sql_statement = "SELECT * FROM Client_Contacts"
Set MyRecSet = db.OpenRecordset(sql_statement)
 
Thanks for your help. In VB, I have the following checked off in the References section:

Visual Basic for Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft DAO 3.6 Object Library


How would I qualify the recordset type?
 
Code:
ADO:  Dim rs As ADODB.Recordset
      Dim cnn As ADODB.Connection
      Dim sql_statement as String
      sql_statement = "SELECT * FROM Client_Contacts"
      Set cnn = CurrentProject.Connection
      Set rs = New ADODB.Recordset
      rst.Open (sql_statement), cnn, adOpenStatic


DAO:  Dim rs As DAO.Recordset
      Dim sql_statement as String
      sql_statement = "SELECT * FROM Client_Contacts"
      Set db = CurrentDb()
      Set rs = db.OpenRecordset(sql_statement)

I'm sure there are more ways to do this, and I'm a newbie so there are probably mistakes in my code. I'd wait for someone else's blessing before I tried what I wrote here.

Onwards,

Q-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top