[AccessD] .Recordcount returns -1?

Erwin Craps Erwin.Craps at ithelps.be
Thu Jul 10 12:08:47 CDT 2003


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


More information about the AccessD mailing list