Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2007, 10:02 AM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reports

I am trying to create a report whos underlying record source is a table with two fields. One of these fields can contain duplicate data. I am counting each record in the table where this field contains duplicates. I then want to display the name of this field and the number of times it is in the table. I can't seem to find a way to do this because the detail section of the report wants to display every record in the table. An example of what I am trying to do would be the following:

The table contains 100 records. Of these 100 records one of the field names is County. Each county can be in the table multiple times. I want to count the number of times each county is in the table and display one record in the report detail with the County Name and the number of times it is in the table.

Any insight is greatly appreciated.

Thanks

 
Old May 31st, 2007, 01:43 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You need to base the report on a query, and do this:

Assume tblState
State - text
County - text

Select the state field, and then select the county field twice. Select View Totals, and then change the second county field to Count.

Your SQL will look like this:

SELECT tblState.State, tblState.County, Count(tblState.County) AS CountOfCounty
FROM tblState
GROUP BY tblState.State, tblState.County;

Then base the report off this query.

Did that help?


mmcdonal
 
Old June 4th, 2007, 06:27 PM
Registered User
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply. I found a way to do this with the help of a colleague. I do have another report I need to try so I will try this out and let you know. Thanks again so much for your reply.

LP






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get reports in crystal reports using ASP3.0 candy133 Classic ASP Basics 2 January 26th, 2006 08:26 AM
Comparitive Reports in Crystal Reports tarunm Crystal Reports 1 January 21st, 2006 01:08 AM
comparision among crystal reports and Data reports avats Crystal Reports 0 April 13th, 2005 01:01 PM
How to create/design reports with crystal reports BassmaniaQ Crystal Reports 0 December 14th, 2004 04:58 AM
Reports Manager does not list reports hinesweb BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 25th, 2004 04:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.