sankur
Programmer
- Jul 10, 2002
- 8
hi all
i'm using ado data control to link to a database. I need to display the number of records in a label using the recordcount property. However when i run my form, it displays record 2 as the first record. the position of the first record is taken by record -1(negative) which is blank and is not in my database. The same also happens with the last record, position is -2 and is also blank and also doesn't exist in my database. can anyone help. here is my code:
Private Sub cmdFirst_Click()
If adoSales.Recordset.EOF Then
MsgBox "You have reached the first record", vbCritical
Else
adoSales.Recordset.MoveFirst
lblCurrent.Caption = adoSales.Recordset.AbsolutePosition + 1
lblAll.Caption = adoSales.Recordset.RecordCount
End If
End Sub
i'm using ado data control to link to a database. I need to display the number of records in a label using the recordcount property. However when i run my form, it displays record 2 as the first record. the position of the first record is taken by record -1(negative) which is blank and is not in my database. The same also happens with the last record, position is -2 and is also blank and also doesn't exist in my database. can anyone help. here is my code:
Private Sub cmdFirst_Click()
If adoSales.Recordset.EOF Then
MsgBox "You have reached the first record", vbCritical
Else
adoSales.Recordset.MoveFirst
lblCurrent.Caption = adoSales.Recordset.AbsolutePosition + 1
lblAll.Caption = adoSales.Recordset.RecordCount
End If
End Sub