下面的代碼返回Access VBA中的語法錯誤,我在查詢設計中使用了相同的代碼,這種代碼工作正常。我知道在查詢設計模式與VBA查詢時,SQL代碼可能會有所不同,但我無法確定如何使Access代碼VBA中的代碼無誤地運行。VBA訪問中此SQL語句的語法有什麼問題?
SELECT TOP 1
MAX(CurrentWeek.WeekEnding) AS MaxOfWeekEnding,
CurrentWeek.NWA, CurrentWeek.[NWA Description], CurrentWeek.Plan
FROM
CurrentWeek
INNER JOIN
(tblNWABasic
INNER JOIN
tblProjects ON tblNWABasic.ProjectID = tblProjects.ProjectID) ON CurrentWeek.NWA = tblNWABasic.NWA
GROUP BY
CurrentWeek.NWA, CurrentWeek.[NWA Description], CurrentWeek.Plan
HAVING
(((CurrentWeek.[NWA Description]) Like "*direct cite*"))
ORDER BY
MAX(CurrentWeek.WeekEnding) DESC;
是'CurrentWeek'一個表或查詢?如果是查詢,我們需要看到查詢的定義,因爲它可能實際上導致問題。 – this
CurrentWeek是一張桌子。我想通了,我要調整代碼。 – delnav222