Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variables In A Query

Status
Not open for further replies.

GlenLynam

MIS
Jul 26, 2002
121
I have set a query to pull in the query parameters from another form that is loaded. Is there a character that i can put into one of these that will show all the results.So say i had 4 fields i could narrow down the name but then put something into the other 3 fields to allow all the answers for those.

Hope this makes sense!!!!!

Thanks
 
Could you please post the actual WHERE clause of your query's SQL code ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sure......

SELECT Personal.FirstName, Personal.Surname, Personal.Parent, Courses.CourseName, Courses.CostIncVAT, Training.When
FROM Courses INNER JOIN (Training INNER JOIN Personal ON Training.PersonID = Personal.PersonID) ON Courses.CourseID = Training.CourseID
WHERE (((Personal.Surname)=[forms]![reporting]![txtsurname]) AND ((Training.When)>=[Forms]![ReportingDates]![txtFrom] And (Training.When)<=[Forms]![ReportingDates]![txtTo]) AND ((Training.Completed)=Yes));

As u'll see i want to be able to enter the dates and then enter something in the Surname box, but then on another occasion will want to show all the surnames so would want to add a wildcard a bit like * when you do a windows searh.

Thanks
 
Sorted it!!!....

SELECT Personal.FirstName, Personal.Surname, Personal.Parent, Courses.CourseName, Courses.CostIncVAT, Training.When
FROM Courses INNER JOIN (Training INNER JOIN Personal ON Training.PersonID = Personal.PersonID) ON Courses.CourseID = Training.CourseID
WHERE (((Personal.Surname) Like [forms]![reporting]![txtsurname] & "*") AND ((Training.When)>=[Forms]![ReportingDates]![txtFrom] And (Training.When)<=[Forms]![ReportingDates]![txtTo]) AND ((Training.Completed)=Yes));

Thanks for the response PHV!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top