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!

Optional Parameter (null valued passed)

Status
Not open for further replies.

mswilson16

Programmer
Nov 20, 2001
243
US
Hi All,

Working on a report at the minute. It has a list of unique keys such as A01, A02, A03, A04, A05, B01, B02, B03 etc etc...

What I want to be able to do is have two parameter fields (StartVal and FinishVal) so that I can pass a parameter for all records, from start to a point, from a point to finish, or just a selection.

e.g. If a value is not passed for StartVal then I want it to take for granted that it starts from the beginning.

I have search high and low and can not find anything on the forums.

Thanks in advance

Mswilson
 
Many things alter the approach to this, starting with the version of your software and the database being used, please remember to post the basics.

A common means for doing this is to set a default value for the parameter such as "All", and then code for it in the record selection formula, as in:

(
{?MyParm} = "all"
or
{table.field} in {?MyParm}
)

This will work if you're using Crystal, however if you're passing parameters from an application, and you *can* pass a null, then you'll have to code for it as in:

(
(
isnull({?MyParm})
or
{?MyParm} = "all"
)
or
{table.field} in {?MyParm}
)

Note that NULL checking must be the first thing in a formula.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top