472,110 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,110 software developers and data experts.

Trying to Count records on a report that meet a certain criteria.

Trying to Count records on a report that meet a certain criteria.

Have a text box in the Report Footer that has the following in the Control Source: =Count([Record Type]="S")

This does not work. It counts ALL records whether Record Type = "S" or "M"

There is nothing unique about the records to distinguish S-type records from the M-type records.
Aug 30 '07 #1
5 10678
Denburt
1,356 Expert 1GB
try =Count(iif([Record Type]="S",1,0))
Aug 30 '07 #2
try =Count(iif([Record Type]="S",1,0))

That looked promising, but it didn't work......thanks anyway
Aug 31 '07 #3
Use a Dcount it's a Dlookup but You just replace the Dlookup with Dcount
this one should work for you as long as your just looking at one letter just set it to look at your table or query dcount("[Field_Name]", "Table/Query_Name", "[Critiria]")


'@ A Function with No Criteria @

1.) =DLookUp("[LastName]", "Employees")
-----------------------------------------------------------------------------------------------------
'@ Specifying Numeric Criteria @

1.) =DLookUp("[LastName]", "Employees", "[EmployeeID] = 7")
-----------------------------------------------------------------------------------------------------
'@ Specifying Numeric Criteria That Comes from a Field on a Form @

1.) =DLookUp("[LastName]", "Employees",
"[EmployeeID] = " & Forms![Orders]![EmployeeID])

2.) =DLookUp("[LastName]", "Employees",
"[EmployeeID] = Forms![Orders]![EmployeeID]")
----------------------------------------------------------------------------------------------------
'@ Specifying Textual Criteria @

1.) =DLookUp("[Title]", "Employees", "[LastName] = 'Callahan'")

2.) =DLookUp("[Title]", "Employees", "[LastName] = ""Callahan""")
-----------------------------------------------------------------------------------------------------
'@ Specifying Textual Criteria That Comes from a Field on a Form @

1.) =DLookup("[ContactName]", "[Customers]",
"[CustomerID]='" & Forms![Orders]![CustomerID] & "'")
-----------------------------------------------------------------------------------------------------
'@ Specifying Date Criteria @

1.) =DLookUp("[LastName]", "Employees", "[BirthDate] = #01-27-66#")
-----------------------------------------------------------------------------------------------------
'@ Specifying Multiple Fields in the Criteria @

1.) =DLookUp("[OrderID]", "Orders",
"[CustomerID] = 'SIMOB' And [EmployeeID] = 2")

2.) Result = DLookup("[OrderID]", "Orders",
"[CustomerID] = '" & CustID & "' And [EmployeeID] = " & EmpID)
-----------------------------------------------------------------------------------------------------
Aug 31 '07 #4
Denburt
1,356 Expert 1GB
Well I am sure there are many ways but I went and tested one and it worked so try this. Two text boxes one in the detail section named text6

=IIf([Delivery_Month]>=#1/1/2008#,1,0)

with a running total. Then the one in the footer referencing the one in the detail section.

=[text6]

You could also accomplish this using VBA using the detail on format event but then I am sure I could think of a hundred ways this one was quick and easy.

Let me know how it goes.
Aug 31 '07 #5
Denburt
1,356 Expert 1GB
Sorry MG saw yours after I posted.

Personally I try to avoid Dlookup when I can it really consumes the resources and depending on the report it could slow things down drastically.

Definitely a workable solution though.
Aug 31 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.