Re: Function not returning a recordset

Tech-Archive recommends: Fix windows errors by optimizing your registry



"RDunlap" <RDunlap@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:12BA9A58-1CE2-44FC-9C07-4E91AA5B3567@xxxxxxxxxxxxxxxx
I'm trying to create a function that will return a recordset, but
everytime I
try to access the recordset, it says it is closed. ExecSP runs a stored
procedure that returns records. Here is my code:
<SNIP>

rstSPResults.Close
Set rstSPResults = Nothing

Remove these lines from your function. When you return the recordset from
your function, what you're actually returning is a POINTER to rstSPResults,
not a NEW recordset. So if you close rstSPResults, the resulting recordset
is also closed, because it's actually the SAME recordset.


.