probably a simple recordset question

thewiseguy

Registered User.
Local time
Today, 23:55
Joined
Apr 14, 2004
Messages
56
recordset question

hey there -

there is probably a very easy answer to this but i just can't figure it out and can't find it, or maybe i have and don't understand it...

i have Public rsttemp As Recordset, rstfinal As Recordset

at some point in a Private Sub, i wish to set rstfinal to that of rsttemp (constructed elsewhere), so i think I'm right in using:

Set rstfinal = rsttemp

i now wish to perform a RecordCount on rstfinal but it won't let me - do i have to open it first? how do i go about doing that?

thank you...
 
Last edited:
Wise,

What message do you get?

To get a recordcount, you generally have to do a .MoveFirst followed by
a .MoveLast

If you don't do that, the .RecordCount is generally 0. Is that what you
meant by not allowed?

Wayne
 
my code includes the following:

Code:
    If rstfinal.RecordCount = 0 Then
        Me.autoSampleSize = "0"
    Else
        rstfinal.MoveLast
        Me.autoSampleSize = rstfinal.RecordCount
    End If

It's exactly the same as I have used earlier with different recordsets but it won't work here. The only difference I see is that in the earlier use, I have used

Code:
Set rst = CurrentDb.Openrecordset(strsql)

where strsql was a bit of sql code.

in the problem case i have simply used:

Code:
Set rstfinal = rsttemp

i.e. i haven't used an 'openrecordset' operation
 
jeez-louise!

i can't believe i'm making such basic errors...
i stupidly closed rsttemp earlier on which doesn't help when i want to work on rstfinal!

my apologies for clogging the boards - i appreciate all the time people have taken to read my problems and think about what's wrong.

i can only hope that my errors might help some other person in the future.
(i am still learning y'know)
 

Users who are viewing this thread

Back
Top Bottom