Help with count in query

  • Thread starter Thread starter Loretta
  • Start date Start date
L

Loretta

I need to do a count in a query or form that I can use for further
calculations. I have the query done but it counts the ID and then multiplys
it by the count. So if I have three records it reports it as 9, 2two records
as 4, four records as 12.
This is a select query. I tried to attach and send the file but it was
refused.
 
Loretta

It would help to see your query.

Open the query in design mode. Change the view to the SQL view. Copy the
SQL statement and paste it into your next post.

Regards

Jeff Boyce
<Access MVP>
 
SELECT DISTINCTROW Count([Alarm responses].ID) AS CountOfID, [Alarm
responses].ID, First(Lookup.Company) AS [First Of Company],
First(Lookup.Address1) AS [First Of Address1], First(Lookup.Address2) AS
[First Of Address2], First([Alarm responses].[Alarm Date]) AS [FirstOfAlarm
Date]
FROM Lookup RIGHT JOIN [Alarm responses] ON Lookup.ID = [Alarm responses].ID
GROUP BY [Alarm responses].ID;
 
Loretta

Are you certain that you and Access are using the same definition of the
aggregate function "First"? (I suspect not)

What happens if you only count the IDs? If you can get that portion
running, perhaps you could then "chain" (my terminology) additional queries
by using the output of the first query as part of your source in a second,
and so on.

Good luck

Jeff Boyce
<Access MVP>

Loretta said:
SELECT DISTINCTROW Count([Alarm responses].ID) AS CountOfID, [Alarm
responses].ID, First(Lookup.Company) AS [First Of Company],
First(Lookup.Address1) AS [First Of Address1], First(Lookup.Address2) AS
[First Of Address2], First([Alarm responses].[Alarm Date]) AS [FirstOfAlarm
Date]
FROM Lookup RIGHT JOIN [Alarm responses] ON Lookup.ID = [Alarm responses].ID
GROUP BY [Alarm responses].ID;

Jeff Boyce said:
Loretta

It would help to see your query.

Open the query in design mode. Change the view to the SQL view. Copy the
SQL statement and paste it into your next post.

Regards

Jeff Boyce
<Access MVP>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Count in a query 7
help with count 1
Access Dcount (multiple criteria) 3
Show counts on form 2
Access Count query 1
Crosstab query help 1
Count function help 3
Counting Records Delima 5

Back
Top