[AccessD] Checking for Records in Recordsets

Bill Benson bensonforums at gmail.com
Sun Apr 13 22:14:28 CDT 2014


A question: why are you setting Me.recordset = rstTemp?

Personally I don't see how rstTemp.EOF I'd giving an error when the Set
statement just prior to that does not.

I could see if the Set statement was failing how the assignment might not
replace the prior existing definition of rstTemp, as happens when setting
other objects equal to something undefined will do (I think).

Anyway, no help here, sorry, just questions!
On Apr 13, 2014 9:17 PM, "David Emerson" <newsgrps at dalyn.co.nz> wrote:

> Listers,
>
>
>
> I have some code that gets recordsets and applies them to the sources of a
> number of combobox controls.
>
>
>
> The code looks like this:
>
>
>
>     Set rstTemp = basRunDataObject("dbo.spfrmFunderServiceCode " &
> Nz(Me!cboFilter, 0), adCmdText)
>
>     Set Me.Recordset = rstTemp
>
>
>
>     Set rstTemp = rstTemp.NextRecordset
>
>
>
>     If rstTemp.EOF <> True Then 'Record exists
>
>         Set Me!cboSearch.Recordset = rstTemp
>
>     Else
>
>         Set Me!cboSearch.Recordset = Null
>
>     End If
>
>
>
> The stored Procedure has a number of select statements to get a number of
> record sets.
>
>
>
> When a recordset has no records then an error 424 (Object Required) appears
> when the "If rstTemp.EOF <> True" line is processed.  This seems to be
> telling me that if a recordset has no records then it doesn't even get
> returned as an empty recordset.  However, when I have multiple recordsets I
> can use the "Set rstTemp = rstTemp.NextRecordset"  line to move to the next
> expected recordset and it is the correct one for the next control.
>
>
>
> How can I check if there are any records in a returned recordset and clear
> the control source?
>
>
>
> Regards
>
> David Emerson
> Dalyn Software Ltd
> Wellington, New Zealand
>
>
>
>
>
> --
> 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