by Dinesh Thakur Category: DataBase

You can use the Record count and absolute position properties of the Data Control Recordset to display the RecordNum and RecordCount when viewing DataBase Records.





Record 10 of 45


The RecordCount property holds the number of records in a recordset.The absolute position holds the position of the current Record in the Recordset.However absolute postion is zerobased i.e; the first record has an absolute position of 0.Therefore, you must add 1 to the proprty to produce the RecordNum.




IntCurrentRecord = Data1.Rescordset.Absolute postion + 1

You cannot use the absolute position property as a record Num , because the position num changes as records are added and deleted.




Private sub Record Num( )

Dim RecordCount, CurrentRecord as integer

RecordCount = Data1.Recordset.RecordCount

CurrentRecord = Data1.Recordset.Absolute Position + 1

If Data1.Recordset.eof then

Data1.Caption = "EOF"


Data1.Caption = " Record " & CurrentRecord & " of " & RecordCount


End sub


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.