出现错误3134:插入的语法错误

时间:2021-02-06 15:40:05

I am trying to insert data from two different tables to one table, but the data is not getting imported. I am getting subject error.

我试图将两个不同的表中的数据插入到一个表中,但数据没有被导入。我遇到了主题错误。

sql = " INSERT INTO TblUserApps ( TblUserDatabase_[ID], [EmployeeName], [EmpCode], [PFNo], [Department_ID], " _
       & " [AICCallAutomation(CAA)], [AICChat], [AICEmail], [AICMailview], [AICVoice], [BulkSMS], [ComplaintHandlingSystem-GQ&DQ], " _
       & " [CSRScript], [ComplaintManagementSystem-C&WS], [DWS], [E4ME], [EMCais], [ESMA], [MessageBoard], [OnlineTest], [OPMIS], " _
       & " [PMS-PortManagementSystem], [SoftexAccess], [StaffDB], [WFMRTA-CC], [ACDAccess], [ComplaintManagementSystem-ES], " _
       & " [HarmonyPMSRecording], [SMSIntranetApplication], [DQVaretisAgent], [InformationService], [WFMRTA-DQ], [UCIAgent], " _
       & " [CBCMInitialPrestige], [KB], [InternetBrowsing], [CIM], [eBill], [NBA], [CBCMInitialALL], [KBIS], " _
       & " [CBCMInitialSales], [KBHS&MS], [KBECS], [Weyak], [Greetune], [EMS], [Motive], [LoyaltyAccess], [NBAAccessEnabling], [ECCF], " _
       & " [ACS], [700#], [SAR], [CBCM], [SharedDrive], [SharePointKB], [ECCFAdmin], [DOP], [SOH], [BBPartner], [EMSSMS], [EMSTicketing], [UserName] ) " _
       & " SELECT TblUserDatabase.[ID], TblUserDatabase.[EmployeeName], TblUserDatabase.[EmpCode], TblUserDatabase.[PFNo], " _
       & " TblUserDatabase.[Department_ID], TblAppsSecs.[AICCallAutomation(CAA)], TblAppsSecs.[AICChat], " _
       & " TblAppsSecs.[AICEmail], TblAppsSecs.[AICMailview], TblAppsSecs.[AICVoice], TblAppsSecs.[BulkSMS], " _
       & " TblAppsSecs.[ComplaintHandlingSystem-GQ&DQ], TblAppsSecs.[CSRScript], TblAppsSecs.[ComplaintManagementSystem-C&WS], " _
       & " TblAppsSecs.[DWS], TblAppsSecs.[E4ME], TblAppsSecs.[EMCais], TblAppsSecs.[ESMA], TblAppsSecs.[MessageBoard], " _
       & " TblAppsSecs.[OnlineTest], TblAppsSecs.[OPMIS], TblAppsSecs.[PMS-PortManagementSystem], TblAppsSecs.[SoftexAccess], " _
       & " TblAppsSecs.[StaffDB], TblAppsSecs.[WFMRTA-CC], TblAppsSecs.[ACDAccess], TblAppsSecs.[ComplaintManagementSystem-ES], " _
       & " TblAppsSecs.[HarmonyPMSRecording], TblAppsSecs.[SMSIntranetApplication], TblAppsSecs.[DQVaretisAgent], " _
       & " TblAppsSecs.[InformationService], TblAppsSecs.[WFMRTA-DQ], TblAppsSecs.[UCIAgent], TblAppsSecs.[CBCMInitialPrestige], " _
       & " TblAppsSecs.[KB], TblAppsSecs.[InternetBrowsing], TblAppsSecs[CIM], TblAppsSecs.[eBill], TblAppsSecs.[NBA], " _
       & " TblAppsSecs.[CBCMInitialALL], TblAppsSecs.[KBIS], TblAppsSecs[CBCMInitialSales], TblAppsSecs.[KBHS&MS], " _
       & " TblAppsSecs.[KBECS], TblAppsSecs.[Weyak], TblAppsSecs.[Greetune], TblAppsSecs.[EMS], TblAppsSecs.[Motive], " _
       & " TblAppsSecs.[LoyaltyAccess], TblAppsSecs.[NBAAccessEnabling], TblAppsSecs.[ECCF], TblAppsSecs.[ACS], TblAppsSecs.[700#], TblAppsSecs.SAR, TblAppsSecs.CBCM, " _
       & " TblAppsSecs.[SharedDrive], TblAppsSecs.[SharePointKB], TblAppsSecs.[ECCFAdmin], TblAppsSecs.[DOP], TblAppsSecs.[SOH], TblAppsSecs.[BBPartner], TblAppsSecs.[EMSSMS], TblAppsSecs.[EMSTicketing], TblAppsSecs.[Username] " _
       & " FROM TblUserDatabase, TblAppsSecs " _
       & " WHERE TblUserDatabase.[Department_ID] = TblUserApps.[Department_ID] " _
       & " AND TblUserDatabase.Batchnumber = '" & BatchNumber & "' "

DoCmd.RunSQL sql

Struggling to solve this. Please support.

苦苦挣扎解决这个问题。请支持。

1 个解决方案

#1


1  

You have written:

你写:

& " FROM TblUserDatabase, TblAppsSecs " _
& " WHERE TblUserDatabase.[Department_ID] = TblUserApps.[Department_ID] " _

In FROM use tables: TblUserDatabase, TblAppsSecs

在FROM使用表中:TblUserDatabase,TblAppsSecs

In WHERE use tables: TblUserDatabase and TblUserApps

在WHERE中使用表:TblUserDatabase和TblUserApps

Where do you have defined TblUserApps?

你在哪里定义了TblUserApps?

#1


1  

You have written:

你写:

& " FROM TblUserDatabase, TblAppsSecs " _
& " WHERE TblUserDatabase.[Department_ID] = TblUserApps.[Department_ID] " _

In FROM use tables: TblUserDatabase, TblAppsSecs

在FROM使用表中:TblUserDatabase,TblAppsSecs

In WHERE use tables: TblUserDatabase and TblUserApps

在WHERE中使用表:TblUserDatabase和TblUserApps

Where do you have defined TblUserApps?

你在哪里定义了TblUserApps?