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 51 52 53 54 55 56 57 58 59 60
| Private Sub Commande137_Click()
On Error GoTo Commande137_Error
Dim db As Database
Dim RS As DAO.Recordset
'--------------------------------------------------
'Copie des données sélectionnées dans la table temp
'--------------------------------------------------
CurrentDb.Execute "INSERT INTO temp ( N°, Job, [Date], MontantHT, BusinessUnit, Client, [Client final], Panel, Products, [From], Until, [Date Of Entry], Budget, [Currency], [Conditions] )SELECT facturation.N°, facturation.Jobn°, facturation.DateFacturation, facturation.Amount, [Job book].BusinessUnit, [Job book].Client, [Job book].[Client final], [Job book].Panel, [Job book].Product, [Job book].From, [Job book].Until, [Job book].DateofEntry, [Job book].Budget, [Job book].Currency, [Job book].[Payment terms] FROM [Job book] INNER JOIN facturation ON [Job book].Jobn° = facturation.Jobn° WHERE (facturation.N°)= " & SQLWhere & " "
MsgBox "La table a été mise à jour avec succès", vbInformation + vbOKOnly, "Impression des factures"
Set db = CurrentDb()
Set RS = db.OpenRecordset("temp")
RS.Index = "Job"
While Not RS.EOF
RS.Edit
var1 = ProchainNumeroFormate(Year(Date), Month(Date))
var2 = Right(var1, 7)
'var3 = DLookup("[BusinessUnit]", "Job Book", Job)
var4 = DLookup("[Adress]", "Clients", RS![Client])
var5 = DLookup("[Complement]", "Clients", RS![Client])
var6 = DLookup("[Post_Code]", "Clients", RS![Client])
var7 = DLookup("[City]", "Clients", RS![Client])
var8 = DLookup("[Country]", "Clients", RS![Client])
var9 = DLookup("[Contact Name]", "Clients", RS![Client])
var10 = DLookup("[Departement]", "Clients", RS![Client])
var11 = [Internal Contact] = DLookup("[SalesRepr]", "Job Book", "Job")
RS![calculdate] = var1
RS![InvoiceN°] = var2
RS![Adress1] = var4
RS![Adress2] = var5
RS![Post_Code] = var6
RS![City] = var7
RS![Country] = var8
RS![Contact Name] = var9
RS![Departement] = var10
'RS![Internal Contact] = var11
RS.Update
'--------------------------------------
'Passage à l'enregistrement suivant
'--------------------------------------
liste:
RS.MoveNext
Wend |
Partager