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

iif else in query not exactly returning the right results 1

Status
Not open for further replies.

dpelizzari

IS-IT--Management
Jul 23, 2010
17
0
0
US
I have never tried this before, but I was asked to create a calculated field based on information in a query. basically, if a field is blank, then select another field, if that field is blank, select a third. Here is what I wrote:
Code:
  IIf (LEN( [Remedy Budget])>9 , [Remedy Budget], IIf (LEN ([Lease Budget])>9, [Lease Budget], [VPN Budget]), [VPN Budget])

I think I am missing something in the format, probably an open/close paranthesis

Any help (as always) is greatly appreciated.
 
you just had an extra term in there

try this --
Code:
IIf( LEN([Remedy Budget]) > 9 
   , [Remedy Budget]
   , IIf( LEN([Lease Budget]) > 9
        , [Lease Budget]
        , [VPN Budget] ))

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
thanks, r937, a second set of eyes always makes it easier!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top