Solved

set db, set recordset .. type mismatch

Posted on 2004-04-22
6
719 Views
Last Modified: 2012-06-22
hello i'm back :)
i'm trying to open a recordset, database connection.

i have a form, with a button, i press the button and go to a sub.

private Sub bt_blaat_Click()

'I tried adding
' Dim wsSessie as Workspace
' Set wsSessie.OpenDatabse(CurrentDb)
'doesnt make a difference

Dim db As Database
Dim rsRead As Recordset

Set db = CurrentDb

Set rsRead = db.OpenRecordset("tablename", dbOpenTable)
rsRead.MoveLast
rsRead.MoveFirst

end Sub

error: type mismatch

("typen komen niet overeen")

does anyone have any idea of what i'm doeing wrong?
all help is welcome...




0
Comment
Question by:mazzl
6 Comments
 
LVL 10

Expert Comment

by:RichardCorrie
Comment Utility
try
Set rsRead = db.OpenRecordset("tablename", dbOpenDynaset)

I guess your table "tablename" is a linked table; for some reason Access will not open a linked table with dbopentable but will with dbOpendynaset - they do the same thing!!

Richard

0
 
LVL 1

Accepted Solution

by:
dssdb earned 130 total points
Comment Utility
'dim you recordset as DAO. Be sure to include a reference to DAO in your references.

Dim rsRead As DAO.Recordset
0
 

Author Comment

by:mazzl
Comment Utility
Tried it.."Set rsRead = db.OpenRecordset("tablename", dbOpenDynaset)"
same error
brrr i already did this once succesfull in an other program and it worked just fine :S

"tablename" is the name of the table.. it's really called "advies_recept_middel_koppel"

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:mazzl
Comment Utility
can somebody explain the need for DAO.etc.. to me, when do i need to use this?
i already had some problems with this.

what i think now is that Dao is a library of something, but for what is it etc?
0
 
LVL 1

Expert Comment

by:dssdb
Comment Utility
It's because the RECORDSET object is used by 2 different libraries: ADO and DAO.  If you don't put DAO before your declaration it'll assume you're trying to use the ADO recordset object.  Statements like OpenRecordset are not supported by ADO.

Alternatively you could have removed the ADO reference from your project.  Then Access would not have been confused.


0
 

Expert Comment

by:stratcat35
Comment Utility
Defining the Recordset as DAO did work for me.  One difference, however, is that I defined the OpenRecordSet statement with no dbDynaSet, dbSnapShot, etc. parameters: Set Rec_Set = CurrentDb.OpenRecordset(strQuery)

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now