[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

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
0
bobrossi56
Asked:
bobrossi56
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
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..

0
 
bobrossi56Author Commented:
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])));
0
 
Rey Obrero (Capricorn1)Commented:
use this { no space on field StudentName }


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],[StudentName])));
0
 
bobrossi56Author Commented:
Works great...thx
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now