query to find results for two people

jabjab25

New member
Local time
Today, 16:19
Joined
May 2, 2013
Messages
8
[SOLVED] query to find results for two people

hi there so here is the story to the problem i have created a parameter query which will find a students best and worst time for each exercise they have done. so you enter the student ID when you run the query and it works fine but i have a problem i need to query to find two students in particular and then i have to create a report from this query on the two students identified and this is where i come up stuck. i have tried typing in both student id's into the criteria but this doesnt work no matter if i put and in it or not and im not sure how to get the job done any help would be amazing.
 
Last edited:
You need to have a parameter for each student ID you search for.
Show you query and also what you put in!
 
what do you mean by that i have a paramter on there atm which when you press run you enter the student id and i finds just 1 student id i cant get it to find 2 students that i need i have attached the database and the query you need to look at is the qryReport one take a look and see what i doing wrong
 

Attachments

Last edited:
So did I mean it:
.... HAVING (((tblStudents.StudentID)=[Please enter 1 student ID])) OR (((tblStudents.StudentID)=[Please enter 2 student ID]));
Put together:
SELECT tblStudents.StudentID, tblStudents.StudentForename, tblStudents.StudentSurname, tblExercise.ExerciseID, tblExercise.Description, Max(tblResults.RepsorTime) AS MaxOfRepsorTime, Min(tblResults.RepsorTime) AS MinOfRepsorTime
FROM tblStudents INNER JOIN (tblExercise INNER JOIN tblResults ON tblExercise.ExerciseID = tblResults.ExerciseID) ON tblStudents.StudentID = tblResults.StudentID
GROUP BY tblStudents.StudentID, tblStudents.StudentForename, tblStudents.StudentSurname, tblExercise.ExerciseID, tblExercise.Description
HAVING (((tblStudents.StudentID)=[Please enter 1 student ID])) OR (((tblStudents.StudentID)=[Please enter 2 student ID]));
 
that seems way to complicated to me is there an easir way to do it as i have to replicate something like this in an exam and this is the final session so im likely not going to remember that is there an easir way, like something you can type into the criteria
 
Do you mean type the student ID into the criteria row, yes but put each on a separate row to cause an OR condition

Brian
 
What is complicated, (you want to find 2 ID's, then you have to enter 2 ID's)?
You could also create a form, put in a combo box or list box, select the students you want. Then write some VBA-code that pick out the selected ID's and run a query.
 

Users who are viewing this thread

Back
Top Bottom