Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

iif Function in Query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mattc66 - 29 Mar 2006 17:29 GMT
I am using the IIF function to show the data in one of two fields.

Exp1: iif([FLD1]=null,[FLD2],[FLD1])

What I want to happen, is to see the data found in FLD2 if FLD1 is blank,
else it will show data in FLD1.

Note: FLD1 is a Date/Time and FLD2 is a Text fld.

What I get with the above formula; It shows only the FLD1 Data.

What am I doing wrong?

Thanks
Matt

Signature

Matt Campbell
mattc (at) saunatec [dot] com

Duane Hookom - 29 Mar 2006 17:56 GMT
You can never get a result from comparing Null to any value. Try
   Exp1: Nz([FLD1],[FLD2])

Signature

Duane Hookom
MS Access MVP
--

>I am using the IIF function to show the data in one of two fields.
>
[quoted text clipped - 11 lines]
> Thanks
> Matt
Tom Lake - 29 Mar 2006 18:08 GMT
> You can never get a result from comparing Null to any value. Try
>    Exp1: Nz([FLD1],[FLD2])

Would

Exp1: IIf(IsNull([FLD1]), [FLD2], [FLD1])

Do it?

Tom Lake
Duane Hookom - 29 Mar 2006 18:12 GMT
It should have taken you about 10 seconds to test this (if you had Access
available).

Either method should work if FLD1 is actually null and not an empty string.

Signature

Duane Hookom
MS Access MVP
--

>> You can never get a result from comparing Null to any value. Try
>>    Exp1: Nz([FLD1],[FLD2])
[quoted text clipped - 6 lines]
>
> Tom Lake
Tom Lake - 29 Mar 2006 18:33 GMT
> It should have taken you about 10 seconds to test this (if you had Access
> available).

Yes, I actually knew it would work but I was employing the Socratic method
of asking a question to effect a learning experience rather than elicit information.

Tom Lake
Duane Hookom - 29 Mar 2006 19:20 GMT
I hadn't noticed that you weren't the original poster. My bad.

Signature

Duane Hookom
MS Access MVP
--

>> It should have taken you about 10 seconds to test this (if you had Access
>> available).
[quoted text clipped - 4 lines]
>
> Tom Lake
mattc66 - 29 Mar 2006 18:46 GMT
I removed the =null from the function and it worked as desired. Thanks for
the suggestions.

Matt

>It should have taken you about 10 seconds to test this (if you had Access
>available).
[quoted text clipped - 6 lines]
>>
>> Tom Lake

Signature

Matt Campbell
mattc (at) saunatec [dot] com

mattc66 - 29 Mar 2006 18:46 GMT
I removed the =null from the function and it worked as desired. Thanks for
the suggestions.

Matt

>> You can never get a result from comparing Null to any value. Try
>>    Exp1: Nz([FLD1],[FLD2])
[quoted text clipped - 6 lines]
>
>Tom Lake

Signature

Matt Campbell
mattc (at) saunatec [dot] com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.