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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using recordset in Access 2

Status
Not open for further replies.

shafi

Programmer
Aug 20, 2000
1
US
Hi,

I have following code in a access form,

Set ws = DBEngine.Workspaces(0)
Set db = OpenDatabase(CurrentDb.Name)
Set mainrst = db.OpenRecordset("select * from members")

But my program does not seem to recognize the mainrst's properties. I think I need to include some reference libraries. I do not know which.

I am using Access-2000 and have following libraries already included under "Tools->References"

Visual Basic For Applications
Microsoft Access 9.0 Object Library
Microsoft Office 9.0 Object Library
Microsoft DAO 3.6 Object library
Microsoft Forms 2.0 Object Library
OLE Automation
Microdoft Visual Basic for Entensibility 5.3


in that order. Can someone suggest me if I need to add some more libraries or there is some other way?

Thanks in advance.

Shafi.

 
You need to use a little different format. The reference library, Microsoft DAO 3.6 Object library, should cover what you need. You should qualify the recordset and database as being a DAO object. Your could also use ADODB for the recordset and database. The ADODB is the Microsoft preferred way but the DAO will work.

Here is an example form one of my programs.

Dim RSMT As DAO.Recordset, dbs As DAO.Database

Set dbs = CurrentDb
SqlString = "UPDATE Equipment " _
& "SET equipmentName = " & """Samuel Adams""" _
& " WHERE equipmentKey = 1 ;"
dbs.Execute SqlString
 
The following came from the microsoft website. It sure helped me out!!!

SYMPTOMS
If you dimension an object as a Recordset and then set that object to databaseobject.OpenRecordset(source), you may get the following error message:

Run time error '13': Type mismatch

CAUSE
If your project contains references to both the Data Access Objects (DAO) library and the ActiveX Data Objects (ADO) library, you may see multiple Recordset entries in the list box when you dimension the Recordset object. This error occurs when you list the ADO library with a higher priority than the DAO library in the References dialog box, regardless of which Recordset entry you select from the list box.

RESOLUTION
If you need only the DAO Recordset object, make sure that the reference for the DAO object library has a higher priority in the References dialog box, or clear the reference to Microsoft ActiveX Data Objects.

If you need to reference and use both DAO and ADO Recordset objects, dimension the objects explicitly as follows:

Dim adoRS As ADODB.Recordset
Dim daoRS As DAO.Recordset
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top