473,569 Members | 2,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 10848
1,356 Recognized Expert Top Contributor
try =Count(iif([Record Type]="S",1,0))
Aug 30 '07 #2
2 New Member
try =Count(iif([Record Type]="S",1,0))

That looked promising, but it didn't work......thank s anyway
Aug 31 '07 #3
90 New Member
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
1,356 Recognized Expert Top Contributor
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


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


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
1,356 Recognized Expert Top Contributor
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

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 as is my style I agreed figuring that over time it's just another language and style anyway to add to the others I've worked in. Heres my...
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 Outlook Inbox every hour for the existence of a mail from a certain address. If it finds one, it saves the attachment and then imports the contents...
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. Thank you -- ---------------------------------------------- Posted with NewsLeecher v3.0 Final
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 the same textbox because there are three possible values and I need a count on each. I can't just do a simple DCount on the table and manually define...
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 be any records that satisfy the criteria at a particular time then the report produces with one line in the detail section that says "#Error". This...
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 to select the records I want...)
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 patients in a table Const strDBPath = "C:\Patients.mdb" ' external database Set dbPatients = OpenDatabase(strDBPath,...
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 3-----112345678901 Widget 4-----543287652345 I need a query that will check every 4 characters in the string of field 2 and look for all instances of '1223' OR...
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 the EOF either of these metods would work for what I need Dim RstQueryCheckCal As DAO.QueryDef
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.