[AccessD] Paging Recordsets

Charlotte Foust cfoust at infostatsystems.com
Tue Jun 1 10:50:53 CDT 2004


Mummy!  Make him stop!! <G>

Charlotte Foust

-----Original Message-----
From: Jim Lawrence (AccessD) [mailto:accessd at shaw.ca] 
Sent: Friday, May 28, 2004 4:47 PM
To: Access Developers discussion and problem solving
Subject: RE: Re: [AccessD] Paging Recordsets


Charlotte...

I did after all state that it was not complete, just correct in
concept...

so there :-p :-)
Jim



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Charlotte
Foust
Sent: Friday, May 28, 2004 5:28 PM
To: Access Developers discussion and problem solving
Subject: RE: Re: [AccessD] Paging Recordsets


Well, I never have much occasion to use the Clone method, so what can
you expect? <G>  I claim exemption from blushing, since you didn't show
a declaration for the recordset object rsMyRecordset!!

Charlotte Foust

-----Original Message-----
From: Jim Lawrence (AccessD) [mailto:accessd at shaw.ca] 
Sent: Friday, May 28, 2004 2:58 PM
To: Access Developers discussion and problem solving
Subject: RE: Re: [AccessD] Paging Recordsets


Hi Charlotte:

<comment>
Have you tested this, Jim?  I thought the .Clone method was for DAO
recordsets.    You can't just pass an ADO recordset to a DAO recordset
unless they've changed something dramatically in the latest MDAC.
</comment>

No I have not tested the previous piece of code but I have a number of
similar pieces of code, in various programs out there. Below is an exact
piece just cut and pasted in just for your edification:

<code>
The Function:
Public Function FillFileAgencyData(lngEmployeeNumber As Long) As
ADODB.Recordset

    Dim objCmd As ADODB.Command

    On Error GoTo Err_FillFileAgencyData

    Set objCmd = New ADODB.Command
    With objCmd
        .ActiveConnection = gstrConnection
        .CommandText = "REFileAgency"
        .CommandType = adCmdStoredProc
        .Parameters.Append .CreateParameter("@EmployeeNumber",
adInteger, adParamInput, , lngEmployeeNumber)
    End With

    Set FillFileAgencyData = New ADODB.Recordset
    With FillFileAgencyData
        .CursorLocation = adUseClient
        .Open objCmd, , adOpenDynamic, adLockOptimistic
    End With

Exit_FillFileAgencyData:
    On Error Resume Next
    Set objCmd = Nothing
    Exit Function

Err_FillFileAgencyData:
    ShowErrMsg "Module: DataConnection, Function: FillFileAgencyData"
    Resume Exit_FillFileAgencyData

End Function
</code>

The caller:
<code>
...
Dim rsFileAgency As New ADODB.Recordset
Set rsFileAgency =
FillFileAgencyData(typFileAgency.EmployeeNumber).Clone
...
</code>

...and it works like a hot D... So even an old master like yourself can
learn something. <grin>

Jim


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list