Link to home
Create AccountLog in
Avatar of bobrossi56
bobrossi56

asked on

Access 2003 Query Criteria

I have a query that asks the user for a date range and a student name. This works fine. However, I want to have it show ALL students if the user leaves the student name prompt blank. is that possble?
thx experts...BobR
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

in the criteria for the student name, use

nz([Enter Student Name],[Student Name])

this is assuming that the name of the field you are applying the criteria is [Student Name]


post the sql of the query you are using..

Avatar of bobrossi56
bobrossi56

ASKER

SELECT tblHorseAssign.ReportDate, tblHorseAssign.HorseName, tblHorseAssign.ReportedBy, tblHorseAssign.Paid, tblHorseAssign.PaidBy, tblHorseAssign.StartTime, tblHorseAssign.EndTime, tblHorseAssign.StudentName
FROM tblHorseAssign
WHERE (((tblHorseAssign.ReportDate) Between [Enter Start Date] And [Enter End Date]) AND ((tblHorseAssign.StudentName)=nz([Enter Student Name],[Student Name])));
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Works great...thx