M
Mike C
I'm getting a run time error 3135 syntax error in JOIN
operation. Anyone see how it is wrong? Thanks in advance.
Function SA()
Dim q As String
q = "INSERT INTO tbl_SA ( PKG_CTR_NR, Driver, SA ) " & _
"SELECT TOP 5 O910IA_VDVRS0720.PKG_CTR_NR, " & _
"Trim([EMP_LST_NA]) & "", "" & Trim([EMP_INI_NA]) AS
Driver, " & _
Sum(O910IA_VDVRS0720.DVR_SAP_QY) AS SA " & _
"FROM O910IA_VMAST0720 INNER JOIN O910IA_VDVRS0720 ON " & _
"(O910IA_VMAST0720.WND_DT = O910IA_VDVRS0720.WND_DT) " & _
"AND (O910IA_VMAST0720.EMP_NR = O910IA_VDVRS0720.EMP_NR "
& _
"WHERE (((O910IA_VDVRS0720.PAY_CGY_CD) " & _
"In (""06"",""05"",""5A"",""6A""))) GROUP BY " & _
"O910IA_VDVRS0720.PKG_CTR_NR, Trim([EMP_LST_NA]) & "", ""
& Trim([EMP_INI_NA]) " & _
"HAVING (((O910IA_VDVRS0720.PKG_CTR_NR) = ""1000"")) " & _
"ORDER BY Sum(O910IA_VDVRS0720.DVR_SAP_QY) DESC;"
DoCmd.RunSQL (q)
End Function
operation. Anyone see how it is wrong? Thanks in advance.
Function SA()
Dim q As String
q = "INSERT INTO tbl_SA ( PKG_CTR_NR, Driver, SA ) " & _
"SELECT TOP 5 O910IA_VDVRS0720.PKG_CTR_NR, " & _
"Trim([EMP_LST_NA]) & "", "" & Trim([EMP_INI_NA]) AS
Driver, " & _
Sum(O910IA_VDVRS0720.DVR_SAP_QY) AS SA " & _
"FROM O910IA_VMAST0720 INNER JOIN O910IA_VDVRS0720 ON " & _
"(O910IA_VMAST0720.WND_DT = O910IA_VDVRS0720.WND_DT) " & _
"AND (O910IA_VMAST0720.EMP_NR = O910IA_VDVRS0720.EMP_NR "
& _
"WHERE (((O910IA_VDVRS0720.PAY_CGY_CD) " & _
"In (""06"",""05"",""5A"",""6A""))) GROUP BY " & _
"O910IA_VDVRS0720.PKG_CTR_NR, Trim([EMP_LST_NA]) & "", ""
& Trim([EMP_INI_NA]) " & _
"HAVING (((O910IA_VDVRS0720.PKG_CTR_NR) = ""1000"")) " & _
"ORDER BY Sum(O910IA_VDVRS0720.DVR_SAP_QY) DESC;"
DoCmd.RunSQL (q)
End Function