Re: Effects on RST in Calling Proc



Tim Marshall wrote:
Here's the scenario, A2003, Jet back end, illustrated with some cut down code at the end of the post:

A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens it. There are several nested do loops, going through the records in rst using .movenext. At one point in one of the loops, we'll say the rst is at record "a". Now, another subprocedure is called, passing rst to it.

In the subprocedure, the recordset goes through a do loop and the sub evaluates each record for various criteria, again, using .movenext. By the time the subproc is done with the recordset, it is at the last record. We then go back to the calling proc.

Will the recordset in the calling procedure still be at record "a"? Or will it be at the end?

I've assumed the last is true and for now, in the main procedure, I figure dimming a second recordset and setting it to the same as the first. I thought using the second set would bypass any problems running through the recordset in the second procedure.

Thanks for any comments on this.

Whether or not the effects of move operations on the recordset in the procedure it's passed to are reflected in the calling procedure on return is easily tested so I assume your question is does it make sense to open two recordsets. I'd say no. You can always save your position before passing the recordset and return to it after the call. I believe
that is a legitimate/safe use of a Bookmark.



.



Relevant Pages

  • RE: Tracking Log In and Log Out times of Users
    ... Dim rst As Recordset. ... A Report module is the same, except it is specific to that report. ... I have a start-up form that opens when the database opens. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Stopping a Thread
    ... thread it just gets a recordset and then loops through the recordset and ... loads each record into a custom drawn list control. ... > the piece of code is remarkably silly, in that it simply loops; ... So I created threads to load the list controls ...
    (microsoft.public.vc.mfc)
  • Re: Effects on RST in Calling Proc
    ... the ByVal keyword does not have the same effect" I ... You are passing the recordset by reference, the default, ... >A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens ... There are several nested do loops, going through the records in rst ...
    (comp.databases.ms-access)
  • Re: Effects on RST in Calling Proc
    ... >> A proc dims a snapshot recordset and opens ... There are several nested do loops, going through the records in rst ... mess with the known state. ...
    (comp.databases.ms-access)
  • Re: Effects on RST in Calling Proc
    ... I believe your assumption about the recordset being at the last record is ... A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens ... There are several nested do loops, going through the records in rst ... In the subprocedure, the recordset goes through a do loop and the sub ...
    (comp.databases.ms-access)

Quantcast