473,418 Members | 2,233 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 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 10837
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

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

Similar topics

1
by: RobMea | last post by:
I am trying to find a solution to the following problem. First off I'm new to Access and SQL but have a good back ground in other languages, thus at a new job this has just been dumped on me so...
4
by: Mark | last post by:
Hi All, I'm trying my hardest to learn VBA but have run into a problem which hopefully someone can guide me with. Basically what I am trying to achieve is to get the database to check the users...
2
by: someone | last post by:
How can I limit the number of records a Query retrieves or at least limit the number of records returned on a report. I only want to print the top 5 or 10 returns of a query into a weekly reort....
3
by: Rebekkah | last post by:
I did a search but couldn't find a question similar to mine. I need to count the values in a textbox on a report and have the count subtotal in a group footer. But I need three different counts on...
1
by: Bhujanga | last post by:
I have some reports whose purpose is to show whether any records currently meet certain criteria, so of course the report is based on a query where that criteria is defined. If there don't happen to...
1
by: Doug | last post by:
What is the simplest way to make a report where only the records where a field matches a certain date are included, and the user first selects that date (from form or popup)? (I can write the SQL...
2
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following code to get the recordset of an external database. Dim dbPatients As Database Dim rsCountPatients As Recordset ' to count number of...
12
by: KPR1977 | last post by:
In an Access Database for field2, the data values could consist of the following: ---field1-------------field2------- Widget 1-----112398764567 Widget 2-----987611236789 Widget...
5
by: phill86 | last post by:
Hi I want to be able to count records in a dao.querydef recordset but I keep getting the error message method or data member not found I have also tried to find out if the recordset is at...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.