Solved

How to use 'Count' in Access for a field of type string

Posted on 2014-12-02
1
169 Views
Last Modified: 2014-12-02
Dear All,

I have a table with the following fields.  I'm trying to count the number of times the same string appears in ItemID, the same string in ModelID for each LocationID.

ID (Number)
ItemID (String)
LocationID (Number)
ModelID (String)

I've tried:

SELECT Count([Table1].ItemID) AS ItemCount, Count([Table1].ModelID) AS ModelCount, [Table1].LocationID
FROM 
(SELECT DISTINCT [Table1].LocationID FROM  [Table1] );

Open in new window




The error states Query does not include LocationID as part of Aggregate function.  

Thanks
0
Comment
Question by:AndyC1000
1 Comment
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 40477813
try

SELECT Count([Table1].ItemID) AS ItemCount, Count([Table1].ModelID) AS ModelCount, [Table1].LocationID
FROM  [Table1]
Group By  [Table1].LocationID
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now