Count in Parameter Query

G

Guest

I'm trying to set up a parameter query and also have a count of the same
field with parameters. I keep getting errors. Basically have employee first
and last name, then on the Gender field [Enter Male or Female] and I also
want to have a total for the gender field but cannot get it to work. Any
tips on how to do this? Or if it's possible to use the Count function in a
report based on this same parameter query?
 
G

Guest

PARAMETERS [Enter Male or Female] Text ( 255 );
SELECT Count(Gender) AS CountOfGender
FROM YourTableName
GROUP BY Gender
HAVING Gender = [Enter Male or Female];
 
G

Guest

OK, I usually stick to Design View, not SQL - here is the SQL from one query.
How would I change it to count records for Session A?

SELECT tblRegistration.[First Name], tblRegistration.[Last Name],
[tblWorkshop Selections].[Session A]
FROM tblRegistration INNER JOIN [tblWorkshop Selections] ON
tblRegistration.ID = [tblWorkshop Selections].ID
GROUP BY tblRegistration.[First Name], tblRegistration.[Last Name],
[tblWorkshop Selections].[Session A]
HAVING ((([tblWorkshop Selections].[Session A])=[Enter Workshop Number A1 -
A5]));


Thank you!

Jerry Whittle said:
PARAMETERS [Enter Male or Female] Text ( 255 );
SELECT Count(Gender) AS CountOfGender
FROM YourTableName
GROUP BY Gender
HAVING Gender = [Enter Male or Female];
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Jeannie said:
I'm trying to set up a parameter query and also have a count of the same
field with parameters. I keep getting errors. Basically have employee first
and last name, then on the Gender field [Enter Male or Female] and I also
want to have a total for the gender field but cannot get it to work. Any
tips on how to do this? Or if it's possible to use the Count function in a
report based on this same parameter query?
 
G

Guest

Try this:

SELECT tblRegistration.[First Name],
tblRegistration.[Last Name],
[tblWorkshop Selections].[Session A],
Count([tblWorkshop Selections].[Session A]) As SessionAs
FROM tblRegistration
INNER JOIN [tblWorkshop Selections]
ON tblRegistration.ID = [tblWorkshop Selections].ID
GROUP BY tblRegistration.[First Name],
tblRegistration.[Last Name],
[tblWorkshop Selections].[Session A]
HAVING [tblWorkshop Selections].[Session A]) =
[Enter Workshop Number A1 - A5];

--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Jeannie said:
OK, I usually stick to Design View, not SQL - here is the SQL from one query.
How would I change it to count records for Session A?

SELECT tblRegistration.[First Name], tblRegistration.[Last Name],
[tblWorkshop Selections].[Session A]
FROM tblRegistration INNER JOIN [tblWorkshop Selections] ON
tblRegistration.ID = [tblWorkshop Selections].ID
GROUP BY tblRegistration.[First Name], tblRegistration.[Last Name],
[tblWorkshop Selections].[Session A]
HAVING ((([tblWorkshop Selections].[Session A])=[Enter Workshop Number A1 -
A5]));

Thank you!

Jerry Whittle said:
PARAMETERS [Enter Male or Female] Text ( 255 );
SELECT Count(Gender) AS CountOfGender
FROM YourTableName
GROUP BY Gender
HAVING Gender = [Enter Male or Female];
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Jeannie said:
I'm trying to set up a parameter query and also have a count of the same
field with parameters. I keep getting errors. Basically have employee first
and last name, then on the Gender field [Enter Male or Female] and I also
want to have a total for the gender field but cannot get it to work. Any
tips on how to do this? Or if it's possible to use the Count function in a
report based on this same parameter query?
 

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