Retrieve number of records in access database

Slider

Member
Joined
Jun 11, 2009
Messages
22
Programming Experience
Beginner
Hi

Could someone please offer some advice on how to retrieve the number of records (rows) in an access database and display on a form please (vb.net)?

Also, is it possible to display (in a label) the last record in the database, which will then update when another record is added?

Thank you.
 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,056
Programming Experience
10+
"last" is a subjective term. Define it more clearly and I can advise

Until then:

Count:
SELECT Count(*) FROM table

Most recently added assuming id is an incrementing primary key:
SELECT * FROM table WHERE id_column = (SELECT MAX(id_column) FROM table)
 
Top Bottom