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
| Public Sub AlimenterTable()
Dim oRst As Recordset
Dim N°_denvoi As String
Dim Goods_total As String
Dim Shipment_cost As String
Dim Insurance As String
Dim Cost_Total As String
Dim Gross_Weight As String
Dim Net_weight As String
Dim Number_of_parcels As String
Dim sql As String
Set oRst = CurrentDb.OpenRecordset("Table1")
oRst.MoveFirst
Do While Not oRst.EOF
If oRst(1) Like "Goods*" Then
Goods_total = oRst(1)
oRst.MoveNext
End If
Shipment_cost = oRst(1)
oRst.MoveNext
Insurance = oRst(1)
oRst.MoveNext
Cost_Total = oRst(1)
oRst.MoveNext
Gross_Weight = oRst(1)
oRst.MoveNext
Net_weight = oRst(1)
oRst.MoveNext
Number_of_parcels = oRst(1)
oRst.MoveNext
N°_denvoi = oRst(1)
sql = "INSERT INTO InvTeToChk ( Goods_total, Shipment_cost, Insurance,Cost_Total,Gross_Weight,Net_weight,Number_of_parcels,N°_d'envoi ) " _
& "SELECT """ & Goods_total & """ AS Expr1 (Like ""Goods total*""), " _
& """" & Shipment_cost & """ AS Expr2 (Like ""Shipment cost*""), " _
& """" & Insurance & """ AS Expr3 (Like ""Insurance*""), " _
& """" & Cost_Total & """ AS Expr4 (Like ""Total*""), " _
& """" & Gross_Weight & """ AS Expr5 (Like ""Gross Weight*""), " _
& """" & Net_weight & """ AS Expr6 (Like ""Net weight*"")), " _
& """" & Number_of_parcels & """ AS Expr7 (Like ""Number of parcels*"")," _
& """" & N°_denvoi & """ AS Expr8 (Like ""N° d'envoi*"");"
DoCmd.SetWarnings False
DoCmd.RunSQL sql
DoCmd.SetWarnings True
oRst.MoveNext
Loop
sortie:
oRst.Close
Set oRst = Nothing
End Sub |
Partager