[AccessD] .Recordcount returns -1?

Bruce Bruen bbruen at bigpond.com
Thu Jul 10 16:19:47 CDT 2003


Primarily, IMHO this is one downer with ADO, in an attempt to be all
things to all people one of the most commonly used DAO features
essentially doesn't work anymore.

Having studied this extensively (almost as much as trying to find a way
around the damned OXP suckurity model) I can "almost" understand why the
ADO recordcount has been rendered useless.

I havent tried this, just thought of it, but if you only want the <u>
current recordcount of the <b>local</b> recordset <u> does this work.


Blah bah
Rst.MoveLast
MyRecCount=rst.absoluteposition+1
Rst.movefirst

Hth, I gotta get a train will be back in a hour or so.
Bruce

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Erwin Craps
Sent: Friday, 11 July 2003 3:09 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] .Recordcount returns -1?


Im not sure anymore but I had the same prob.

1) or it is not supported by ADODB Oracle.
2) Or you gotta first go to the last record so he can count ...

If the records set is opened in a certain way (thus when other users add
new records they are added to your opened recordset) the recordcount
does not work neither....





-----Oorspronkelijk bericht-----
Van: Sad Der [mailto:accessd666 at yahoo.com] 
Verzonden: donderdag 10 juli 2003 15:13
Aan: Acces User Group
Onderwerp: [AccessD] .Recordcount returns -1?


Hi,

those damn 2 years that i've been Oracle-ing...

I use a ADODB recordset in my A2K application. With
this recordset I get all date from a table. The table
has 1 record.

When I use the code below rst.Recordcount returns -1.
Why is that? MsgBox .Fields(0) returns 01/07/2003 So
it should pick it up.

What am i missing?

thnx in advance,
Sander

    Dim conn As ADODB.Connection        'db connection
    Dim rst As ADODB.Recordset          'recordset
returned by the query
    Dim strSQL As String
    
    Set conn = CurrentProject.Connection
    Set rst = New ADODB.Recordset
    
    strSQL = "SELECT date FROM tblActivity" 

    With rst
        .ActiveConnection = conn
        .Source = strSQL
        .CursorType = adOpenDynamic
        .Open
        .MoveLast
        .MoveFirst
        MsgBox .Fields(0)
    End With
        
    MsgBox rst.RecordCount

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
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