我在以下SQL查询上遇到运行时错误3075。我试图在MS Access 2010中执行。错误消息告诉我在连接查询上有语法错误(缺少运算符)。我找不到了。
Private Sub comando21_dblclick(cancel As Integer)
Dim st_sql As String
st_sql = "INSERT INTO tblsearchengine01 (
[id event],
[id project],
[id_project_phase],
[owner],
[contact],
[event],
[type],
[participant],
[role_type],
[commitment],
[description],
[identification_status],
[overall_status],
[status],
[tblmasterlistofeventsnotes],
[tblmasterlistofeventshistorynotes],
[automatic user entry],
[automatic date of entry],
[automatic_user_entry],
[automatic_date_of_entry],
[expected start date],
[actual start date],
[expected completion date],
[actual completion date],
[effective date],
[priority]
) SELECT
[tblmasterlistofevents].
[id event],
[tblmasterlistofevents].[id project],
[tblmasterlistofevents].[id_project_phase],
[tblmasterlistofevents].[owner],
[tblmasterlistofeventshistory].[contact],
[tblmasterlistofevents].[event],
[tblmasterlistofeventshistory].[type],
[tblprojmanagementphaseparticipants].[participant],
[tblprojmanagementphaseparticipants].[role_type],
[tblmasterlistofevents].[commitment],
[tblmasterlistofeventshistory].[description],
[tblmasterlistofevents].[identification_status],
[tblmasterlistofevents].[overall_status],
[tblmasterlistofeventshistory].[status],
[tblmasterlistofevents].[notes],
[tblmasterlistofeventshistory].[notes],
[tblmasterlistofevents].[automatic user entry],
[tblmasterlistofevents].[automatic date of entry],
[tblmasterlistofeventshistory].[automatic_user_entry],
[tblmasterlistofeventshistory].[automatic_date_of_entry],
[tblmasterlistofevents].[expected start date],
[tblmasterlistofevents].[actual start date],
[tblmasterlistofevents].[expected completion date],
[tblmasterlistofevents].[actual completion date],
[tblmasterlistofeventshistory].[effective date],
[tblmasterlistofevents].[Priority]
FROM [tblmasterlistofevents]
INNER JOIN [tblprojmanagementphaseparticipants]
ON [tblmasterlistofevents].[id event]=[tblprojmanagementphaseparticipants].[ID_Event]
INNER JOIN [tblmasterlistofeventshistory]
ON [tblmasterlistofevents].[id event]=[tblmasterlistofeventshistory].[ID_Event]"
Application.DoCmd.RunSQL (st_sql)
End Sub
答案 0 :(得分:2)
这是您的from
条款:
FROM [tblmasterlistofevents] INNER JOIN
[tblprojmanagementphaseparticipants]
ON [tblmasterlistofevents].[id event] = [tblprojmanagementphaseparticipants].[ID_Event] INNER JOIN
[tblmasterlistofeventshistory]
ON [tblmasterlistofevents].[id event]= [tblmasterlistofeventshistory].[ID_Event]
进行多个连接时,Access需要括号。试试这个:
FROM ([tblmasterlistofevents] INNER JOIN
[tblprojmanagementphaseparticipants]
ON [tblmasterlistofevents].[id event] = [tblprojmanagementphaseparticipants].[ID_Event]
) INNER JOIN
[tblmasterlistofeventshistory]
ON [tblmasterlistofevents].[id event]= [tblmasterlistofeventshistory].[ID_Event]