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!

Record Selection Query 1

Status
Not open for further replies.

NattyCat

MIS
Aug 9, 2004
38
GB
Crystal 9, SQL Server 7.0

I have a report where the user wishes to choose a Region and Postcode, but may leave one or the other blank.

So, the user may choose {?Region} = "South East" and {?Postcode Prefix} = "TN" which will return all TN postcodes in the South East Region.

However, I need to modify the record selection so that if the User only enters a Region and no postcodes, it will return every postcode within the chosen region. OR, I need to be able to return all chosen postcodes, leaving the region blank.

I'm having a problem trying to get the record selection right.

The fields I have to use are:

{@Postcode Prefix}
{Region}
{?Region}
{?Postcode Prefix}

Any ideas on how the if-then-else statement will work for this?

Thanks

Nat
 
Set a default value of All for each paramter and then use a selection formula like this:


(if {?Region}="All" then true else {mytable.region}= {?Region})
AND
(if {?Postcode}="All" then true else {mytable.Postcode}= {?Postcode})
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top