True, it would. The problem with IIF is that its a function. Before a
function evaluates, any subfunctions AND variables  inside it are evaluated.
When using the DE functions, it tried to evaluate what was in it, which was
a function. This failed, causing the whole thing to fail. This is the reason
I prefer to use quotes in place of DE functions. Saves the problems.

> Thanks, Michael.  The first two approaches work correctly, but the third
> doesn't.  It throws an error as it tries to evaluate CreateODBCDate() if
> the field is left blank.
>
> Jim
>
>
> -----Original Message-----
> From: Michael Dinowitz <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Monday, July 10, 2000 3:16 PM
> Subject: Re: IIf() and DE confusion
>
>
> >#IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', '''NULL''')#
> >
> >Note the use of single and multiple quotes here in place of DE. Using DE
> >instead will look like one of these:
> >
> >#IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', DE('NULL'))#
> >#IIF(IsDate(form.thedate), DE(CreateODBCDate(form.thedate)), DE('NULL'))#
> >
> >More information on this can be found here:
> >http://www.fusionauthority.com/IIF.cfm
> >
> >
> >> I know this can be done, but I'll be hanged if I can figure out the
> right
> >> combination of DE() and ## and quotes and whatever else might be
> needed.
> >> I'm trying to use IIf() in a SQL statement instead of the following:
> >>
> >> thedate = <cfif
> >> IsDate(form.thedate)>#CreateODBCDate(form.thedate)#<cfelse>NULL</cfif>
> >>
> >> Thanks,
> >> Jim
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to