[AccessD] .Recordcount returns -1?

Sad Der accessd666 at yahoo.com
Thu Jul 10 08:12:48 CDT 2003


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


More information about the AccessD mailing list