Need Help Creating a calculations in a query

G

Guest

hello
I have a table with a feild named "Ethnic Group" which has a pull down menu
with various choices (ie. Latino, Caucasion). Im trying to create a query (in
design view):
1. Totals (sum or count?) of each Ethnic Group (ie.50 Latino, 50 Caucasion)
2. Calculate percentages of each Ethnic Group (ie. 50% Latino, 50% Caucasion)

Im creating a query in design view and cant seem to get the expressions
correct.
Any ideas? Thanks ;-)
 
P

PC Datasheet

In a query, you need the fields EthnicGroup and NumberInGroup. While in the
query design view, click on the Sigma button (looks like capital E) in the
toolbar at the top of the screen. Then change Group By under NumberInGroup
to Count. This gives you #1. In a blank field in the query, type in this
expression:
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group"). This
column gives you #2.
 
G

Guest

Hi Again,
I did just what you suggested and I got stuck in two places:
1. It asks for a paramter value? I assumed this would be "latino" ect. It
doesnt work.
2. It says the expression is too long or typed incorrectly (I copied and
pasted what you suggested)
Any ideas?
Help is very much appreciated!!!!
;-)

PC Datasheet said:
In a query, you need the fields EthnicGroup and NumberInGroup. While in the
query design view, click on the Sigma button (looks like capital E) in the
toolbar at the top of the screen. Then change Group By under NumberInGroup
to Count. This gives you #1. In a blank field in the query, type in this
expression:
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group"). This
column gives you #2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


prismlight said:
hello
I have a table with a feild named "Ethnic Group" which has a pull down
menu
with various choices (ie. Latino, Caucasion). Im trying to create a query
(in
design view):
1. Totals (sum or count?) of each Ethnic Group (ie.50 Latino, 50
Caucasion)
2. Calculate percentages of each Ethnic Group (ie. 50% Latino, 50%
Caucasion)

Im creating a query in design view and cant seem to get the expressions
correct.
Any ideas? Thanks ;-)
 
P

PC Datasheet

Post the SQL of your query.


prismlight said:
Hi Again,
I did just what you suggested and I got stuck in two places:
1. It asks for a paramter value? I assumed this would be "latino" ect. It
doesnt work.
2. It says the expression is too long or typed incorrectly (I copied and
pasted what you suggested)
Any ideas?
Help is very much appreciated!!!!
;-)

PC Datasheet said:
In a query, you need the fields EthnicGroup and NumberInGroup. While in
the
query design view, click on the Sigma button (looks like capital E) in
the
toolbar at the top of the screen. Then change Group By under
NumberInGroup
to Count. This gives you #1. In a blank field in the query, type in this
expression:
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group").
This
column gives you #2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


prismlight said:
hello
I have a table with a feild named "Ethnic Group" which has a pull down
menu
with various choices (ie. Latino, Caucasion). Im trying to create a
query
(in
design view):
1. Totals (sum or count?) of each Ethnic Group (ie.50 Latino, 50
Caucasion)
2. Calculate percentages of each Ethnic Group (ie. 50% Latino, 50%
Caucasion)

Im creating a query in design view and cant seem to get the expressions
correct.
Any ideas? Thanks ;-)
 
G

Guest

Hi,
I used what you suggested:

EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group")

Any ideas?
Thanks again so very much!




PC Datasheet said:
Post the SQL of your query.


prismlight said:
Hi Again,
I did just what you suggested and I got stuck in two places:
1. It asks for a paramter value? I assumed this would be "latino" ect. It
doesnt work.
2. It says the expression is too long or typed incorrectly (I copied and
pasted what you suggested)
Any ideas?
Help is very much appreciated!!!!
;-)

PC Datasheet said:
In a query, you need the fields EthnicGroup and NumberInGroup. While in
the
query design view, click on the Sigma button (looks like capital E) in
the
toolbar at the top of the screen. Then change Group By under
NumberInGroup
to Count. This gives you #1. In a blank field in the query, type in this
expression:
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group").
This
column gives you #2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


hello
I have a table with a feild named "Ethnic Group" which has a pull down
menu
with various choices (ie. Latino, Caucasion). Im trying to create a
query
(in
design view):
1. Totals (sum or count?) of each Ethnic Group (ie.50 Latino, 50
Caucasion)
2. Calculate percentages of each Ethnic Group (ie. 50% Latino, 50%
Caucasion)

Im creating a query in design view and cant seem to get the expressions
correct.
Any ideas? Thanks ;-)
 
G

Guest

Hi again,
It says "Can not have aggregate function in expression"
after I do everything you suggested. ;-(


PC Datasheet said:
Post the SQL of your query.


prismlight said:
Hi Again,
I did just what you suggested and I got stuck in two places:
1. It asks for a paramter value? I assumed this would be "latino" ect. It
doesnt work.
2. It says the expression is too long or typed incorrectly (I copied and
pasted what you suggested)
Any ideas?
Help is very much appreciated!!!!
;-)

PC Datasheet said:
In a query, you need the fields EthnicGroup and NumberInGroup. While in
the
query design view, click on the Sigma button (looks like capital E) in
the
toolbar at the top of the screen. Then change Group By under
NumberInGroup
to Count. This gives you #1. In a blank field in the query, type in this
expression:
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group").
This
column gives you #2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


hello
I have a table with a feild named "Ethnic Group" which has a pull down
menu
with various choices (ie. Latino, Caucasion). Im trying to create a
query
(in
design view):
1. Totals (sum or count?) of each Ethnic Group (ie.50 Latino, 50
Caucasion)
2. Calculate percentages of each Ethnic Group (ie. 50% Latino, 50%
Caucasion)

Im creating a query in design view and cant seem to get the expressions
correct.
Any ideas? Thanks ;-)
 
G

Guest

Thnaks for all your help so far.
Using your ideas I got my question to #1 to work perfectly! (I even figured
out how to narrow the seach ( design view)to include only specific fiscal
years. ;-)
Im still stuck on question #2 on creating the correct expression to
calculate the percentages instead of the totals. What you suggested doesnt
work. ;-(
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group")
Any more ideas?

PC Datasheet said:
In a query, you need the fields EthnicGroup and NumberInGroup. While in the
query design view, click on the Sigma button (looks like capital E) in the
toolbar at the top of the screen. Then change Group By under NumberInGroup
to Count. This gives you #1. In a blank field in the query, type in this
expression:
EthnicGroupPercent:[CountOfNumberInGroup]/DCount("*","[Ethnic Group"). This
column gives you #2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


prismlight said:
hello
I have a table with a feild named "Ethnic Group" which has a pull down
menu
with various choices (ie. Latino, Caucasion). Im trying to create a query
(in
design view):
1. Totals (sum or count?) of each Ethnic Group (ie.50 Latino, 50
Caucasion)
2. Calculate percentages of each Ethnic Group (ie. 50% Latino, 50%
Caucasion)

Im creating a query in design view and cant seem to get the expressions
correct.
Any ideas? Thanks ;-)
 

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

Top