[AccessD] .Recordcount returns -1?

Haslett, Andrew andrew.haslett at ilc.gov.au
Fri Jul 11 06:41:25 CDT 2003


"this is one downer with ADO, in an attempt to be all
things to all people..."

Actually its the opposite IMO.  It has different methods for different
requirements.

Why open a recordset and waste resources traversing all the records to get a
recordcount when the need is not required?  Thats why there are different
cursor types. It actually attempts to be *more* efficient and be adaptable
to different situations or requirements.

Cheers,
Andrew

-----Original Message-----
From: Bruce Bruen [mailto:bbruen at bigpond.com]
Sent: Friday, 11 July 2003 6:50 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] .Recordcount returns -1?


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

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.


More information about the AccessD mailing list