1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Dim strSQL As String
Dim Criteria As String
Select Case ChoixTypeEcriture
Case 1
Criteria = "TypeEcriture = 1 Or TypeEcriture = 2"
Case 2
Criteria = "TypeEcriture = 0"
Case 3
Criteria = "1"
End Select
strSQL = "INSERT INTO DONNEES_CG ( oidPIECE, [date], comptegen, montant, société, référence, referenceOrigine, typeEcriture ) " & _
"SELECT SOCIETEX_VUE_COMPTEGEN.oid, SOCIETEX_VUE_COMPTEGEN.dateReference, " & _
"SOCIETEX_VUE_COMPTEGEN.codeCompte, SOCIETEX_VUE_COMPTEGEN.Solde, SOCIETEX_dbo_TETABLISSEMENT.code " & _
"AS codeE, SOCIETEX_VUE_COMPTEGEN.reference, SOCIETEX_VUE_COMPTEGEN.referenceOrigine, SOCIETEX_VUE_COMPTEGEN.typeEcriture " & _
"FROM SOCIETEX_dbo_TETABLISSEMENT INNER JOIN SOCIETEX_VUE_COMPTEGEN ON SOCIETEX_dbo_TETABLISSEMENT.oid = SOCIETEX_VUE_COMPTEGEN.oidEtablissement " & _
" WHERE " & Criteria & " " & _
"GROUP BY SOCIETEX_VUE_COMPTEGEN.oid, SOCIETEX_VUE_COMPTEGEN.dateReference, SOCIETEX_VUE_COMPTEGEN.codeCompte, " & _
"SOCIETEX_VUE_COMPTEGEN.Solde, SOCIETEX_dbo_TETABLISSEMENT.code, SOCIETEX_VUE_COMPTEGEN.reference, " & _
"SOCIETEX_VUE_COMPTEGEN.referenceOrigine, SOCIETEX_VUE_COMPTEGEN.typeEcriture;"
CurrentDb.Execute strSQL |
Partager