Record Counting

  • Thread starter Thread starter dpdeleon
  • Start date Start date
D

dpdeleon

When a form opens up I'd like to be able to determine the number of records
in the recordset. What methods can I use?
 
Form in design view...
Menu bar: View>Code
In the Sub Form_Open
[Example]
Private Sub Form_Open(Cancel As Integer)
Label1.Caption = DCount("[field1]", "Table1")
End Sub

You can change the result to go to a variable or another
textbox or wherever you need it. In the above example
field1 is any field you choose to count in the recordset
Table1 (or whatever you are calling it) - I usually will
use the ID or Key field for this.

See DCount in Access Help for further explanation.
 
If you meant the Form's Recordset then you can simply use

Me.RecordsetClone.RecordCount

to see how many Records are in the Form
 
Back
Top