Solved

set db, set recordset .. type mismatch

Posted on 2004-04-22
6
729 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Expert Comment

by:RichardCorrie
ID: 10887863
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
ID: 10887922
'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
ID: 10887934
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:mazzl
ID: 10887954
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
ID: 10888046
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
ID: 11154672
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

752 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