LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Microsoft Query and IIf

I build simple Excel queries through Excel's Microsoft Query and send
them to clients. They operate off a SQL Server database.

Is there a way to use the IIf function or Case When statement in one of
these .dqy queries? When I try to use IIf, MS Query doesn't complain
about IIf, but I can't get past an "Incorrect syntax near '=' message
when I try to run the query.

Here's part of my query:

Sum(IIf(CRType='W', -CRAmount, CRAmount))

I've also tried without success the following:

Sum(Case When CRType="W" Then -CRAmount Else CRAmount End)

Any ideas? Is it even possible? This needs to be done in Microsoft Query
and saved as a .dqy file. I can do this using Access or VBA in Excel, so
I am not looking for that type of solution.

Thanks for looking.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"