PC Review


Reply
Thread Tools Rate Thread

replace recordsetclone in ADO recordset

 
 
dorji dukpa
Guest
Posts: n/a
 
      8th Nov 2003
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
> 0)

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
 
Reply With Quote
 
 
 
 
Juan M. Afan de Ribera
Guest
Posts: n/a
 
      8th Nov 2003
The only thing you have to change is the line

Dim rst As DAO.Recordset

with

Dim rst As ADODB.Recordset

because in adp projects a form recordset is ADO type instead of DAO type.

HTH

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


"dorji dukpa" <(E-Mail Removed)> escribió en el mensaje
news:090001c3a5e6$6bb15230$(E-Mail Removed)...
> 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
> > 0)

> 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



 
Reply With Quote
 
dorji dukpa
Guest
Posts: n/a
 
      9th Nov 2003
Even in adp projects the forms still have DAO recordset.
Moreover the ADODB recordset does not support
RECORDSETCLONE method.

Dorji
>-----Original Message-----
>The only thing you have to change is the line
>
> Dim rst As DAO.Recordset
>
>with
>
> Dim rst As ADODB.Recordset
>
>because in adp projects a form recordset is ADO type

instead of DAO type.
>
>HTH
>
>--
>Saludos desde Barcelona
>Juan M. Afan de Ribera
><MVP Ms Access>
>http://www.juanmafan.tk
>http://www.clikear.com/webs4/juanmafan
>
>
>"dorji dukpa" <(E-Mail Removed)>

escribió en el mensaje
>news:090001c3a5e6$6bb15230$(E-Mail Removed)...
>> 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
>> > 0)

>> 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

>
>
>.
>

 
Reply With Quote
 
Juan M. Afan de Ribera
Guest
Posts: n/a
 
      9th Nov 2003
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" <(E-Mail Removed)> escribió en el mensaje
news:042b01c3a699$4da87a80$(E-Mail Removed)...
Even in adp projects the forms still have DAO recordset.
Moreover the ADODB recordset does not support
RECORDSETCLONE method.

Dorji
>-----Original Message-----
>The only thing you have to change is the line
>
> Dim rst As DAO.Recordset
>
>with
>
> Dim rst As ADODB.Recordset
>
>because in adp projects a form recordset is ADO type

instead of DAO type.
>
>HTH
>
>--
>Saludos desde Barcelona
>Juan M. Afan de Ribera
><MVP Ms Access>
>http://www.juanmafan.tk
>http://www.clikear.com/webs4/juanmafan
>
>
>"dorji dukpa" <(E-Mail Removed)>

escribió en el mensaje
>news:090001c3a5e6$6bb15230$(E-Mail Removed)...
>> 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
>> > 0)

>> 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

>
>
>.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DAO, Recordset, RecordsetClone, ADODB Abdul Shakeel Microsoft Access 2 29th May 2008 01:24 PM
Help !!! - Recordset set to Me.RecordsetClone =?Utf-8?B?S2V2aW4gTWNDYXJ0bmV5?= Microsoft Access Queries 1 26th Mar 2004 05:37 PM
Re: Recordset or RecordsetClone???? Dirk Goldgar Microsoft Access Forms 0 26th Aug 2003 05:13 AM
Re: Recordset or RecordsetClone - or am I just a Dolt! Albert D. Kallal Microsoft Access 1 26th Aug 2003 12:15 AM
Re: Recordset or RecordsetClone - or am I just a Dolt! John Vinson Microsoft Access 0 25th Aug 2003 11:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:22 AM.