AlphaPress Publishing
P.O. Box 5942 Albany, NY 12205
Tel: 518-250-3890
Email: alphapress@hotmail.com  


  
Click to buy this book from Amazon

Section Menu 

News

Pindaro is now working on a comprehensive book on SQL Server 2014.  For any comments you can email the author at alphapress@hotmail.com.

  

 

 

Create a query with three parameter fields, one of them an expression

To contact the author click here

This article is from the book "Access 2007 Pure SQL

To download the sample database click here


 

Creating a query with three parameter fields, one of them an expression

Retrieve order information using state, city, and ordertotal as parameters

Discussion:

In this example, we use three parameters for the State, City, and TotalOrder fields.  Notice the third parameter ">[Enter Amount Bigger Than:]" for the TotalOrder field.  Here, we use the ">" greater than inequality predicate to retrieve orders from NY and New York City, which are bigger than $200 in this example.  Of course, we could have used any amount for order totals to retrieve the orders we want.  Equality and inequality predicates allow amazing flexibility in parameter queries.   

Code:

SELECT OrderID, OrderDate, City, State

FROM Qry_Parameters_Base

WHERE ((((State)=[Enter State:]) AND (City)=[Enter City:]) AND (totalorder)>[Enter Amount Bigger Than:])

 

Result: