Mark H
Lists at theopg.com
Thu Jul 10 08:31:19 CDT 2003
Ado returns -1 if it can't get the recordcount, or the provider or cursor don't support recordcount. A real pain in the back side... Mark -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Sad Der Sent: 10 July 2003 14:13 To: Acces User Group Subject: [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