Counting number of records in form

  • Thread starter Thread starter Red
  • Start date Start date
R

Red

Can anyone suggest the code that should be used to count
the number of records in a form that contains a certain
value based on a filter run within that form?

I've tried using the code below but it returns 0:

RecCount = DCount("[FieldName]", "QueryName", "FilterValue")

Thanks in advance.
 
The format should be something like this:

Forms!<MainFormName>!<SubFormName>.Form.Recordsetclone.Recordcount.

Such that:

If Forms!<MainFormName>!<SubFormName>.Form.Recordsetclone.Recordcount = 0
Then
Msgbox Prompt:="There are no records to display."
End If

HTH

---

Rob

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Need to launch your application in the appropriate version of Access?
http://www.fmsinc.com/Products/startup/index.asp

Need software tools for Access, VB, SQL or .NET?
http://www.fmsinc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Thanks, that works perfectly.

Wayne Morgan said:
Try Me.Recordset.Recordcount

--
Wayne Morgan
Microsoft Access MVP


Red said:
Can anyone suggest the code that should be used to count
the number of records in a form that contains a certain
value based on a filter run within that form?

I've tried using the code below but it returns 0:

RecCount = DCount("[FieldName]", "QueryName", "FilterValue")

Thanks in advance.
 
Back
Top