Recordset 'State' DAO

nmuser
08-06-2001, 09:41 PM
I'm trying to test the state of a recordset using DAO. In ADO I can use Recordset.Sate - is there a similar method using DAO...can't use ADO as I need to update the recordset via a form which apparently can't be done using ADO till access2002.

Thanks
NM

Thinker
08-06-2001, 09:44 PM
I thought access2000 had built-in support for ADO.

I think therefore I am... sometimes right. images/icons/wink.gif

nmuser
08-06-2001, 09:48 PM
Yes it does, however using Access2000 and ADO you cannot update the recordset via a form...sounds bizzare I know, but I got that from the microsoft support page, therefore I've gotta go with DAO.

dcl3500
08-06-2001, 10:02 PM
In DAO try it like this.
'
' sql statement goes here.
'
Set db = opendatabase("Path to my db")
Set rs = db.openrecordset(sql, dbopendynaset)
' There are more switches you can set here but this is adequate
'
With rs
. edit 'or .addnew if that is apporpriate
.Fields("FieldName").value = "Whatever you need"
.update
.bookmark = .lastmodified
.close
end with
'
db.close
'
set rs = nothing
set db = nothing


Is this what you need to do do. Let me know

Don


Time is the best teacher; unfortunately it kills all its students.

dcl3500
08-06-2001, 10:08 PM
Oh and I forget to mention in DAO you can check the updateable property. That I think is like the State in ADO

Don

Time is the best teacher; unfortunately it kills all its students.

nmuser
08-06-2001, 10:09 PM
I can open, edit, update and close the recordset no problem, but what I am trying to do is test IF the recordset is already open. the code for ADO is:

If rs.state = adstateopen then
rs.close
set rs = nothing
End If

This is what I want to do using DAO. I'm hoping there's an equivalent test like rs.State for DAO.

NM

dcl3500
08-06-2001, 10:19 PM
Ok I misuderstood your ? You need the StillExecuting method to test if the recordset has been opened. I haven't used it myself but i looked it up in msdn so you know where to find it Sorry I couldn't give you any samples on it.

Don


Time is the best teacher; unfortunately it kills all its students.

nmuser
08-06-2001, 10:50 PM
Thanks Don!!

dcl3500
08-06-2001, 10:54 PM
Glad it worked and thanks for letting me know.

Don

Time is the best teacher; unfortunately it kills all its students.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum