MS database query: Statement CASE WHEN THEN ELSE END
It fails because your code is not a valid SQL statement.
These are valid SQL statements:
SELECT employees.EmployeeID, employees.LastName, employees.country
FROM employees WHERE employees.country = 'USA';
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName,
IIf([Employees]![Country]='USA',1,0) AS Country
FROM Employees;
The latter works in Access and as an SQL statement using ADO or DAO,
but I don't know if it will from Excel in the way you are trying.
Hth,
Merjet
|