[英]MS-Access : Syntax error (missing operator) in query expression
I keep getting a syntax error (missing operator) in query expression for this formula in MS-Access
. 我在
MS-Access
此公式的查询表达式中不断收到语法错误(缺少运算符)。
IIf([Employee List].[Employee Type]=”Employee”,Format([Employee List].[Date of Birth],'dd/mm/yyyy'),’01/01/1910’) AS Date of Birth
Basically for employee type employee
show their date of birth in the employee list otherwise show 01/01/1910
for everyone else. 基本上对于员工类型
employee
,在员工列表中显示他们的出生日期,否则为其他人显示01/01/1910
。
Does anyone know why and how I can fix this? 有谁知道为什么以及如何解决这个问题?
Do you really use 3 different kinds of quotes: ”
and '
and '
? 你真的使用3种不同的报价:
”
和'
和'
?
Use either "
or '
. 使用
"
或'
。
Also the alias Date of Birth
should be enclosed in square brackets because it contains spaces, but since it exists already as a column in the table it will produce a circular reference error so change it to something like: 别名
Date of Birth
应该用方括号括起来,因为它包含空格,但由于它已经作为表中的列存在,它将产生循环引用错误,因此将其更改为:
IIf(
[Employee List].[Employee Type] = 'Employee',
Format([Employee List].[Date of Birth], 'dd/mm/yyyy'),
'01/01/1910'
) AS Date_of_Birth
I think your quotes are wrong. 我认为你的报价错了。 MS Access uses double quotes for strings:
MS Access对字符串使用双引号:
IIf([Employee List].[Employee Type] = "Employee",
Format([Employee List].[Date of Birth], "dd/mm/yyyy"),
"01/01/1910"
) AS DateofBirth
Also, the column alias needs to be a single word or be escaped. 此外,列别名需要是单个单词或进行转义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.