Solved

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

Posted on 2014-12-02
1
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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