strSQL = "INSERT INTO audit ( APNO, WSNo, EditDate, [User], SourceField )" & _
" SELECT Getgapno() AS APNO, A.WS_No, A.DtAppnWS, Environ('username') AS User1, "WS Add" AS SourceField" & _
" FROM Audit RIGHT JOIN" & _
" (SELECT TA_WS.WS_No, TA_WS.WS_ActCd, TA_WS.WS_Title, TA_WS.WS_CntrlCd," & _
" TA_WS.WS_DtTgtEngr, TA_WS.WS_DwgNo, TA_WS.DtAppnWS" & _
" FROM TA_WS" & _
" GROUP BY TA_WS.WS_No, TA_WS.WS_ActCd, TA_WS.WS_Title, TA_WS.WS_CntrlCd, TA_WS.WS_DtTgtEngr, TA_WS.WS_DwgNo," & _
" TA_WS.DtAppnWS" & _
" HAVING (((TA_WS.WS_No)<>Exists" & _
" (SELECT WSNo FROM Audit WHERE (((APNO)=getgapno()) AND" & _
" ((EditDate) Between GetgISISDate() And Date()) AND ((SourceField)='WS Add')))) AND" & _
" ((TA_WS.DtAppnWS)>=GetgISISDate()))) AS A" & _
" ON Audit.WSNo = A.WS_No" & _
" WHERE (((Audit.WSNo) Is Null))"
|