Это не приводит к синтаксическим ошибкам, но дает ошибку неправильных аргументов:
SELECT left(
[aname],
IIF(instr([aname], " ") = 0 AND instr([aname], ",") = 0,
Len(FinalForgotten.aname),
IIF(instr([aname], ",") = 0,
InStr(1,[aname]," ")-1,
InStr(1,[aname],",")-1)))
& "," &
right(
[aname],
IIF(instr([aname], " " = 0 AND instr([aname], ",") = 0,
Len(FinalForgotten.aname),
IIF(instr([aname], ",") = 0,
Len(aname)-InStr(1,[aname]," "),
Len(aname)-InStr(1,[aname],",")))))
& " " &
defense_final.middle_initial AS fullname INTO FinalForgottenWithMiddle
FROM FinalForgotten INNER JOIN defense_final ON (right(FinalForgotten.aname,
IIF(instr([aname], ",") = 0,
Len(FinalForgotten.aname)-InStr(1,FinalForgotten.[aname]," "),
Len(FinalForgotten.aname)-InStr(1,FinalForgotten.[aname],",")
)
)=defense_final.first_name) AND (left(FinalForgotten.aname,
IIF(instr([aname], ",") = 0,
InStr(1,FinalForgotten.[aname]," ")-1,
InStr(1,FinalForgotten.[aname],",")-1
)
)=defense_final.last_name);
Итак, добавив дополнительные аргументы, я теперь получаю синтаксическую ошибку «Отсутствует»,] или «Элемент в выражении запроса»:
SELECT left(
[aname],
IIF(instr([aname], " ") = 0 AND instr([aname], ",") = 0,
Len(FinalForgotten.aname),
IIF(instr([aname], ",") = 0,
InStr(1,[aname]," ")-1,
InStr(1,[aname],",")-1)))
& "," &
right(
[aname],
IIF(instr([aname], " ") = 0 AND instr([aname], ",") = 0,
Len(FinalForgotten.aname),
IIF(instr([aname], ",") = 0,
Len(aname)-InStr(1,[aname]," "),
Len(aname)-InStr(1,[aname],","))))
& " " &
defense_final.middle_initial AS fullname INTO FinalForgottenWithMiddle
FROM FinalForgotten INNER JOIN defense_final ON
left(FinalForgotten.aname,
IIF(instr([aname], " ") = 0 AND instr([aname], ",") = 0,
Len(FinalForgotten.aname),
IIF(instr([aname], ",") = 0,
InStr(1,FinalForgotten.[aname]," ")-1,
InStr(1,FinalForgotten.[aname],",")-1)))
=defense_final.last_name AND
right(FinalForgotten.aname,
IIF(instr([aname], " ") = 0 AND instr([aname], ",") = 0,
Len(FinalForgotten.aname),
IIF(instr([aname], ",") = 0,
Len(FinalForgotten.aname)-InStr(1,FinalForgotten.[aname]," "),
Len(FinalForgotten.aname)-InStr(1,FinalForgotten.[aname],","))))
=defense_final.first_name;
Есть обходной путь?
Спасибо за ответ.