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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| Dim db As DAO.Database
Dim db_source As DAO.Database
Dim fic As DAO.Recordset
Dim rub As DAO.Recordset
Dim rub_source As DAO.Recordset
Dim Req As QueryDef
Dim strSQL As String
Dim matricule_recup As String
Dim valeur_temp As Integer
Dim valeur_max As Integer
Dim OTP As String
Dim CProfit As String
Dim Montant As String
Dim Mois As Integer
Dim compte As String
' j'ouvre la base qui contient mes données source
Dim m_met, ind, q_met, d_met, nomreq, q_3quart, q_medi
Set db = DBEngine.OpenDatabase("Import.mdb")
Set rub = db.OpenRecordset("SELECT * FROM [CA] WHERE EX=2011 And CPROFIT BETWEEN 'FR020200' and 'FR020299'")
'ici je recupère lechantillon que je veux
' j'ouvre la base qui va récuperer ces infos
Set db_source = DBEngine.OpenDatabase (Application.CurrentProject.FullName)
Set rub_source = db_source.OpenRecordset("SELECT * FROM [CA]")
Do Until rub.EOF
'Do Until rub_source.EOF
rub_source.MoveFirst
If rub("OTP") <> "" Then
OTP_lu = rub("OTP")
CProfit_lu = rub("CPROFIT")
Montant_lu = rub("MNT")
Mois_lu = rub("PERIODE")
compte_lu = rub("CPTE")
Set rub_source = db_source.OpenRecordset("INSERT INTO [CA] (OTP , CCProfit , MNT , CPE , MOIS) VALUES (" & OTP & "," & CProfit & "," & Montant & "," & compte & "," & Mois & ")")
End if
db.Close
End Function |
Partager