G
Gary Walter
Hi Brian,
PMFBI
If you copy query to Access 97
and look at how the SQL
is changed, it will probably
look like:
SELECT [Policy Number],
COUNT([Assigned Consultant]) AS ConsultantCount
FROM
[SELECT DISTINCT [Policy Number], [Assigned Consultant]
FROM Location]. X
GROUP BY [Policy Number]
The brackets and the ending period were the only
way to use a subquery in the FROM clause in 97.
PLUS...
you could *not* use any brackets within the subquery....
In 97, you will need to save the subquery as a
named stored query (say "qryDistPolNum"):
SELECT DISTINCT [Policy Number], [Assigned Consultant]
FROM Location;
then use the stored query in the FROM clause
in place of the subquery...
SELECT [Policy Number],
COUNT([Assigned Consultant]) AS ConsultantCount
FROM
qryDistPolNum
GROUP BY [Policy Number];
Or.....
change your field names so you there are no spaces
in the name, so you won't have to wrap them in brackets.
Please respond back if I have not been clear
about something....
and apologies for butting in...
Good luck,
Gary Walter
"bdehning"
PMFBI
If you copy query to Access 97
and look at how the SQL
is changed, it will probably
look like:
SELECT [Policy Number],
COUNT([Assigned Consultant]) AS ConsultantCount
FROM
[SELECT DISTINCT [Policy Number], [Assigned Consultant]
FROM Location]. X
GROUP BY [Policy Number]
The brackets and the ending period were the only
way to use a subquery in the FROM clause in 97.
PLUS...
you could *not* use any brackets within the subquery....
In 97, you will need to save the subquery as a
named stored query (say "qryDistPolNum"):
SELECT DISTINCT [Policy Number], [Assigned Consultant]
FROM Location;
then use the stored query in the FROM clause
in place of the subquery...
SELECT [Policy Number],
COUNT([Assigned Consultant]) AS ConsultantCount
FROM
qryDistPolNum
GROUP BY [Policy Number];
Or.....
change your field names so you there are no spaces
in the name, so you won't have to wrap them in brackets.
Please respond back if I have not been clear
about something....
and apologies for butting in...
Good luck,
Gary Walter
"bdehning"
2000 but not Access 97 which I need to run to cover all of our offices.If someone sees this post can they explain why the query you posted works in Access
The issue for mosts of the prior posts must be Office 97 related.
--
Brian
Tom Ellison said:This query is working now:
SELECT [Policy Number],
COUNT([Assigned Consultant]) AS ConsultantCount
FROM (SELECT DISTINCT [Policy Number], [Assigned Consultant]
FROM Location) X
GROUP BY [Policy Number]
If you save this query, then join to it on Policy Number, you can
readily retrieve the ConsultantCount values.
Does this get you to the place you wanted to be?
There were some separate issues I asked about earlier, but you seemed
not to want to pursue them. That's fine with me. Let me know if they
become troublesome. I'll keep the data for a while just in case.
Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
to be smaller.Sent but not sure you will get. I am cutting down a copy as well just in case