Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODC recordcount

Status
Not open for further replies.

sankur

Programmer
Joined
Jul 10, 2002
Messages
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

 
Hi,

You have misued the recordcount function.
The recordcount function means that you have found a particular record. It is normally use as:

if ado.rs.rc <> 0 then (means that a record is found)
blah blah blah
end if

Refer to the following site for details.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top