CASE not working in querys but works in direct SQL?

I am trying to use a CASE statement in a query. I have this snippet of SQL code


SELECT Case
WHEN “Name” = ‘Familj’ THEN ‘On’
WHEN “Name” = ‘Jessica’ THEN ‘On’
WHEN “Name” = ‘Johanna’ THEN ‘On’
WHEN “Name” = ‘Lennart’ THEN ‘On’
WHEN “Name” = ‘Leriks Data’ THEN ‘Off’
WHEN “Name” = ‘Ludvig’ THEN ‘Off’
WHEN “Name” = ‘Marie’ THEN ‘On’
WHEN “Name” = ‘Molly’ THEN ‘Off’
WHEN “Name” = ‘Snö Data’ THEN ‘On’
Else ‘Off’
END as “Visible Text”,
“Visible”,
“Name”
FROM “tblOwner”


it works fine in direct SQL window but when I try to insert this SQL code into a query it says SQL error??? The result is that i can’t create a query for this. Does any one know a way to create a query?

In the query design views toolbar you need to click the run in direct mode icon. In version 7.1 the icon has a green tick,in earlier versions the icon looks a little different.
Hope this helps

Found that I can insert SQL in the first row(Fields) and name it in the sond row (Alias). This solved my issue.
If someone wants a copy of the database just ask.