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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last record in database

Status
Not open for further replies.

trystanhuwwilliams

Programmer
Aug 23, 2002
39
GB
Hi,
Is there a way of storing the number of the last record in a variable. My form needs to know how many records are in the table connected to it. The form contains a VB procedure which tests & changes some of the field values where appropriate. I need to tell the procedure how many records to search through each time - so that when the number of records in the table changes, i won't have to change the code. For example this is how i do it now:-

Thank you in advance,

Trystan
 
Using the recordset cmd. You have the recordcount method.
Ex: With rst
.Movelast 'Populate the recordset
.Movefirst
temp = .recordcount 'This will give you the current number of records in the rst recordset. If you add or delete records you will have to call this routine again or update the temp variable manually.
end with
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top