case statement in sql not working

trying to do a pass through query in Access 2010.

SELECT DISTINCT dbo_t_dispensing_metrics_detail_schedules.Account_Number, 
t_dispensing_metrics_header.Corp_MA_Start_Date, 
t_dispensing_metrics_header.Corp_MA_End_Date, 
t_dispensing_metrics_header.Exempt_From_Terms, 
t_dispensing_metrics_header.Exempt_From_Fee, 
dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Fee_Schedule, 
dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Terms_Schedule,
Case When Fee-Implemented like ‘Yes%’ or Fee-Implemented like ‘Both%’  then ‘Yes’
else ‘No’
END as 'Service Charge'
FROM t_dispensing_metrics_header INNER JOIN dbo_t_dispensing_metrics_detail_schedules ON t_dispensing_metrics_header.Contract_Number_DISP_MA = dbo_t_dispensing_metrics_detail_schedules.Contract_Number_DISP_MA
WHERE dbo_t_dispensing_metrics_detail_schedules.Account_Number Is Not Null 
AND t_dispensing_metrics_header.Exempt_From_Terms=Null 
AND t_dispensing_metrics_header.Exempt_From_Fee =Null AND 
dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Fee_Schedule Is Null 
AND dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Terms_Schedule Is Null
ORDER BY dbo_t_dispensing_metrics_detail_schedules.Account_Number;

Open in new window



Can't get the syntax correct ?

Thanks
fordraiders
LVL 3
FordraidersAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PortletPaulEE Topic AdvisorCommented:
SELECT DISTINCT
  dbo_t_dispensing_metrics_detail_schedules.Account_Number
, t_dispensing_metrics_header.Corp_MA_Start_Date
, t_dispensing_metrics_header.Corp_MA_End_Date
, t_dispensing_metrics_header.Exempt_From_Terms
, t_dispensing_metrics_header.Exempt_From_Fee
, dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Fee_Schedule
, dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Terms_Schedule
, CASE
    WHEN [Fee - Implemented] LIKE 'Yes%' OR
      [Fee - Implemented] LIKE 'Both%' THEN
      'Yes'
    ELSE
      'No'
  END AS [Service Charge]
FROM t_dispensing_metrics_header
INNER JOIN dbo_t_dispensing_metrics_detail_schedules
  ON t_dispensing_metrics_header.Contract_Number_DISP_MA = dbo_t_dispensing_metrics_detail_schedules.Contract_Number_DISP_MA
WHERE dbo_t_dispensing_metrics_detail_schedules.Account_Number IS NOT NULL
AND t_dispensing_metrics_header.Exempt_From_Terms = NULL
AND t_dispensing_metrics_header.Exempt_From_Fee = NULL
AND dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Fee_Schedule IS NULL
AND dbo_t_dispensing_metrics_detail_schedules.Exempt_From_Terms_Schedule IS NULL
ORDER BY dbo_t_dispensing_metrics_detail_schedules.Account_Number;

Open in new window


There were strange quote characters (had you used MS Word for editing?)

{+ edit}
and the column name has spaces so you need to use [] or "" to specify that column name

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FordraidersAuthor Commented:
Thanks.!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.