Try this code
Dim rec as Recordset
Dim db as Database
Set db = Currentdb() ' set a reference to the current database
Set rec = db.OpenRecordset("table_name", dbOpenDynaset) ' this opens the table
rec.MoveFirst ' Move to the first record in table
Text6.Value = rec.Recordcount
rec.Close ' closes the connection to the table
'release the objects
rec = Nothing
db = Nothing
Hope this helps!
|