Access 2000 Recordcount Problem

Results 1 to 2 of 2

Thread: Access 2000 Recordcount Problem

  1. #1
    Join Date
    Dec 1969

    Default Access 2000 Recordcount Problem

    The function below connects to an Access 2000 dB. The X value is returning –1 when I try to count the records, but the connection is working because when I loop through the recordset the correct values are returned in mySTR. Why is the X value –1<BR><BR>Many Thanks in advance.<BR><BR>Public Function rstTEST()<BR>Dim rst As ADODB.Recordset<BR>Dim strSQL As String<BR>Dim X As Integer<BR>Dim mySTR As String<BR><BR>strSQL = "SELECT it.IT_ID, it.IT_Desc, it.IT_Nickname, it.LDA_Order FROM tblIncomeTypes AS it; "<BR><BR>Call dBConnect<BR>Set rst = New ADODB.Recordset<BR>rst.Open strSQL, Conn, , adLockReadOnly<BR><BR>With rst<BR>X = .RecordCount<BR>Debug.Print X<BR> .MoveFirst<BR> Do Until .EOF<BR> mySTR = .Fields("IT_Desc")<BR> Debug.Print mySTR<BR> .MoveNext<BR> Loop<BR>End With<BR><BR>rst.close<BR>Set rst = Nothing<BR>End Function<BR>

  2. #2
    Join Date
    Dec 1969

    Default Well

    You could try the ASPFAQ&#039;s. Link at teh top of this page.<BR><BR>Category: Database Errors

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts