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

Record selection based on 1 of 2 parameters

Status
Not open for further replies.

finbib

IS-IT--Management
Aug 12, 2002
26
US
Good evening all!

I'm using CR XI with SQL 2000. I have a check register report that I need to modify to show checks printed either by a date range or check number range.

I have created parameters for {?From Check Date}, {?To Check Date}, {?From Check Number}, and {?To Check Number}, as well as a parameter for Company number, {?Company}.

The current record selection formula I have is:

Code:
{Table.CKCOMP} = {?Company} and
(({Table.CKCKDT} in {?From Check Date} to {?To Check Date}) or 
({Table.CKCKNO} in {?FromCheckNo} to {?ToCheckNo}))

The company parameter is required.

This formula doesn't let me choose which parameter to run the report on. Right now, I need to enter values for all 4 parameters.

Is there some way I can enter only a company number, and then one set of values, either dates or check numbers?

Cheers,

Bob
 
You might want to use IF/THEN to check to determine which parameter to use.
 

Something like this might help you;



Code:
{Table.CKCOMP} = {?Company}
 
and

((if isnull({?From Check Date})
  then true
 else
{Table.CKCKDT} >= {?From Check Date}) 

   and

(if isnull({?To Check Date})
  then true
 else
{Table.CKCKDT} <= {?To Check Date}))

or 

((if isnull({?FromCheckNo})
   then true
 else
{Table.CKCKNO} => {?FromCheckNo})

   and

(if isnull({?ToCheckNo})
   then true
 else
{Table.CKCKNO} <= {?ToCheckNo}))
 

Something like this might help you;



Code:
{Table.CKCOMP} = {?Company}
 
and

(
((if isnull({?From Check Date})
  then true
 else
{Table.CKCKDT} >= {?From Check Date}) 

   and

(if isnull({?To Check Date})
  then true
 else
{Table.CKCKDT} <= {?To Check Date}))

or 

((if isnull({?FromCheckNo})
   then true
 else
{Table.CKCKNO} => {?FromCheckNo})

   and

(if isnull({?ToCheckNo})
   then true
 else
{Table.CKCKNO} <= {?ToCheckNo}))
)
 
Sorry for the double post, the first set was missing a set of ().

I don't see an "edit" option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top