This example displays the number of records in the Customer recordset in the Nwindex.mdb database.
To create the Nwindex.mdb database, run the Microsoft Excel example for the CreateDatabase method.
Dim db As Database, rs As Recordset
Set db = Workspaces(0).OpenDatabase(Application.DefaultFilePath _
& "\NWINDEX.MDB")
Set rs = db.OpenRecordset("Customer")
On Error GoTo errorHandler
rs.MoveLast
MsgBox "There are " & rs.RecordCount & " records in " _
& rs.Name
rs.Close
db.Close
Exit Sub
errorHandler:
MsgBox "There are no records in " & rs.Name
rs.Close
db.Close