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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help writing query 1

Status
Not open for further replies.

JOEYB99

Technical User
Joined
Jul 9, 2008
Messages
121
Location
CA
Can someone please help me out with some SQL?

Here is the current SQL for a simple query,

SELECT tbl_EmployeeList.[Active Employee], tbl_EmployeeList.Trade, tbl_EmployeeList.Employee, tbl_EmployeeList.[Bruce Power Number], tbl_EmployeeList.[Aecon Number]
FROM tbl_EmployeeList
GROUP BY tbl_EmployeeList.[Active Employee], tbl_EmployeeList.Trade, tbl_EmployeeList.Employee, tbl_EmployeeList.[Bruce Power Number], tbl_EmployeeList.[Aecon Number]
HAVING (((tbl_EmployeeList.[Active Employee])="active"))
ORDER BY tbl_EmployeeList.Trade;

I would like to add the parameter prompt for a field called EPSCA, which has a value of either "Y" or "N".

The output would be different if the user wants this field included as criteria, otherwise there is no change if this prompt excludes it, i.e. EPSCA = "N".
 
You could use something like....

Code:
Where [ESPCA] Like NZ([Enter ESPCA Y/N or blank for all],"") & "*"

That assumes the field is text.

Typically optional filters are added in the opening of the form / report via code as opposed to the query.
 
Thanks lameid.

Couple of questions though.

1. where exactly do I insert this Where statement in my SQL?

2. What is meant by NZ?
 

The WHERE clause belongs after the FROM clause.
The best explanation for the NZ function is in the help files.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top