replace recordsetclone in ADO recordset

D

dorji dukpa

I've a function to Enable/Disable buttons. It works very
well in Access 97/mdb 2000.
<<The Function>
Public Sub EnableButtons(frm As Form, DelBtn As Boolean)
Dim rst As DAO.Recordset
Set rst = frm.RecordsetClone
If frm.NewRecord Then
frm!cmdPrevious.Enabled = True And rst.RecordCount
frm!CmdNext.Enabled = False
Else
rst.Bookmark = frm.Bookmark
rst.MovePrevious
frm!cmdPrevious.Enabled = Not rst.BOF
rst.Bookmark = frm.Bookmark
rst.MoveNext
frm!CmdNext.Enabled = Not (rst.EOF Or
frm.NewRecord)
End If
End Sub

Can anyone suggest as to how make this function work in
Access 2000 Project (.adp) database.?

Thanks in advance
 
D

dorji dukpa

Even in adp projects the forms still have DAO recordset.
Moreover the ADODB recordset does not support
RECORDSETCLONE method.

Dorji
 
J

Juan M. Afan de Ribera

Hi dorji,

I'm afraid that you are wrong. In adp projects the access object form
recordset is ADO recordset (see the form recordset property in help).

Also, recordsetclone is neither DAO nor ADO recordset property, but a
property of a form object, as you can see in the code that you posted in
your first question:

' here frm is a variable that represents a form
Public Sub EnableButtons(frm As Form, DelBtn As Boolean)

' here 'rst' is a variable recordset
Dim rst As DAO.Recordset
' we assign the form's recordset represented in 'frm' variable
' to 'rst' variable through the RecordsetClone property
Set rst = frm.RecordsetClone
...

so, that code works if you are in an mdb file. If you want that code to work
in an adp project, the only thing you have to change is the 'rst' type of
variable from DAO.Recordset to ADODB.Recordset, as I told you in my previous
answer (before posting my answer I tried that in an adp project and it
worked as expected).

--
Saludos desde Barcelona
Juan M. Afan de Ribera
<MVP Ms Access>
http://www.juanmafan.tk
http://www.clikear.com/webs4/juanmafan


"dorji dukpa" <[email protected]> escribió en el mensaje
Even in adp projects the forms still have DAO recordset.
Moreover the ADODB recordset does not support
RECORDSETCLONE method.

Dorji
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top