How to pass one record from a recordset as an argument 
Author Message
 How to pass one record from a recordset as an argument

Hello All

I have a recordset and I'm looping through the recordset to process
some information. I need to call an other procedure and would like to
send the current record that the recordset is pointing to, as an
argument to the other procedure.

I could pass each field seperately to the other procedure, but there
are 30 different fields and I'll  be better off sending the entire
record. Is there a way to do this. Any help will be greatly
appreciated. If you can email please email me at

TIA
Sue..



Sun, 25 Apr 2004 06:59:16 GMT  
 How to pass one record from a recordset as an argument
pass them individually you're actually better off in this case.

If you REALLY have to pass the RS then you can fabricate a new recordset in
ADO.

optionally you can pass it as a Variant Array (look into GetRows() )

Cheers

Gregory A Jackson MCSD, MCT
Sr. Software Engineer
800.com



Sun, 25 Apr 2004 07:09:04 GMT  
 How to pass one record from a recordset as an argument
Dunno if this would work but it could be worth a try. Immediately before
you pass the recordset, filter it on the autonumber field so it just
shows the single current record

rs.Filter "FieldID = " & rs.Fields("FieldID").Value
CallMyProcedure rs
'remove the filter
rs.Filter = ""

Cheers
Dave

Quote:

> Hello All

> I have a recordset and I'm looping through the recordset to process
> some information. I need to call an other procedure and would like to
> send the current record that the recordset is pointing to, as an
> argument to the other procedure.

> I could pass each field seperately to the other procedure, but there
> are 30 different fields and I'll  be better off sending the entire
> record. Is there a way to do this. Any help will be greatly
> appreciated. If you can email please email me at

> TIA
> Sue..



Sun, 25 Apr 2004 15:22:47 GMT  
 How to pass one record from a recordset as an argument
Keep in mind that going to a separate procedure for each row will be slow.
This is stack management being done for each row using the function--a lot
of rows could mean a severe performance hit.

Kevin Sandal


Quote:
> pass them individually you're actually better off in this case.

> If you REALLY have to pass the RS then you can fabricate a new recordset
in
> ADO.

> optionally you can pass it as a Variant Array (look into GetRows() )

> Cheers

> Gregory A Jackson MCSD, MCT
> Sr. Software Engineer
> 800.com



Sun, 25 Apr 2004 08:18:45 GMT  
 How to pass one record from a recordset as an argument
I picture it as two choices:

1) Declare the recordset with global scope to both the functions.
2) Pass the recordset ByRef.  Doing so, you only pass the pointer, which
does not overload the stack, as mentioned on other replies to you.


Quote:
> Hello All

> I have a recordset and I'm looping through the recordset to process
> some information. I need to call an other procedure and would like to
> send the current record that the recordset is pointing to, as an
> argument to the other procedure.

> I could pass each field seperately to the other procedure, but there
> are 30 different fields and I'll  be better off sending the entire
> record. Is there a way to do this. Any help will be greatly
> appreciated. If you can email please email me at

> TIA
> Sue..



Mon, 26 Apr 2004 02:46:39 GMT  
 How to pass one record from a recordset as an argument
Good idea.

I believe however that when marshalling Recordsets, the Filter Property is
not marshalled along with it.

would be interesting to try this method.

GAJ



Sun, 25 Apr 2004 22:18:35 GMT  
 How to pass one record from a recordset as an argument
Function printFieldNamesAndValues(myFlds As ADODB.Fields) As Boolean
on error goto errorhandler:
Dim fld As ADODB.Field

For Each fld In myFlds
    Debug.Print fld.Name & " " & fld.Value
Next fld
printFieldNamesAndValues = true
exit function
errorhandler:
printFieldNamesAndValues = false
End Function

call it like this

where rstSimple is any recordset you have

While Not rstSimple.EOF

    Call printFieldNamesAndValues(rstSimple.Fields)

    rstSimple.MoveNext
wend


Quote:
> Hello All

> I have a recordset and I'm looping through the recordset to process
> some information. I need to call an other procedure and would like to
> send the current record that the recordset is pointing to, as an
> argument to the other procedure.

> I could pass each field seperately to the other procedure, but there
> are 30 different fields and I'll  be better off sending the entire
> record. Is there a way to do this. Any help will be greatly
> appreciated. If you can email please email me at

> TIA
> Sue..



Tue, 27 Apr 2004 16:57:05 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Finding Records and Updating Records in More than one Recordsets

2. Passing one dimension of a variant table as argument of a function

3. Pass argument but only one instance running

4. passing arguments from one form to another

5. Passing arguments from one form to another

6. One instance passing arguments to another

7. How do you pass a recordset as an argument in a function

8. Passing recordset as an argument in a sub?

9. Passing ADO recordsets as function arguments

10. Passing a Recordset as an Argument

11. Passing Recordset as Argument

12. Probs passing recordset argument

 

 
Powered by phpBB® Forum Software