[AccessD] Why doesn't this work?

Robert robert at servicexp.com
Sun Jul 22 13:27:13 CDT 2007


 Arthur,
 Ok let me try and clear some things up... :-)  

IIf(ServOption()=0,>1,ServOption()) is in the criteria area of the saved
query it's in.  The query is a simple select query that returns records of
past services.  

"ServOption()" returns the type of service rendered, (a long value,
representing of the type of service and it's value can be from 2 to
whatever.) which the user selected on a form.  

There is an option to show all service types or a selected type. The
selected type works perfectly, but when I need to display all (i.e. >1) the
query displays no records. If I hard code >1 it works fine, showing all
records...


The service type field in the query is numeric..


Clear as mud eh... :-)


WBR
Robert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Sunday, July 22, 2007 2:07 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Why doesn't this work?

Just a wag, but that query makes no sense to me. This could be the absence
of information, of course, but what you wrote appears non-logical. Maybe you
mis-typed, but given what you supplied and breaking it down, I end up with
this:

IIf(
    ServOption()=0,
    >1,
    ServOption()
)

Perhaps that was one accidental keystroke (the ">") -- that's the part that
makes no sense IMO.

If ServOption() is a static function, then something like this might
possibly work:

(Assume ServOption() currently returns either zero or three, just to choose
some value)

SELECT * FROM mytables
WHERE ServeOption() = 0
OR <whatever serveoption refers to> = ServeOption()

Only one of these ORs can exist so I think that covers the bases. I could be
more specific if I knew exactly what criteria ServeOption() was testing, but
that's the general idea.

hth,
Arthur

On 7/22/07, Robert <robert at servicexp.com> wrote:
>
>
> IIf(ServOption()=0,>1,ServOption())
>
> This is the criteria in a query.
>
> ServOption is a function that returns a long. The query works when 
> ServOption returns a specific option. However if ServOption returns 0, 
> all the records are to be displayed, but doesn't
>
>
>
>
> WBR
> Robert
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list