Record Counting

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?
 
J

jmonty

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.
 
V

Van T. Dinh

If you meant the Form's Recordset then you can simply use

Me.RecordsetClone.RecordCount

to see how many Records are in the Form
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top