mazzl
asked on
set db, set recordset .. type mismatch
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(Curre ntDb)
'doesnt make a difference
Dim db As Database
Dim rsRead As Recordset
Set db = CurrentDb
Set rsRead = db.OpenRecordset("tablenam e", 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...
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(Curre
'doesnt make a difference
Dim db As Database
Dim rsRead As Recordset
Set db = CurrentDb
Set rsRead = db.OpenRecordset("tablenam
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...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tried it.."Set rsRead = db.OpenRecordset("tablenam e", 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_kopp el"
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_kopp
ASKER
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?
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?
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.
Alternatively you could have removed the ADO reference from your project. Then Access would not have been confused.
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(st rQuery)
Set rsRead = db.OpenRecordset("tablenam
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