|
Private Sub CommandButton1_Click()
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ThisWorkbook.Path & "\DB1.MDB;Persist Security Info=False"
Range("A2:L65536").ClearContents
Range("A2").CopyFromRecordset conn.Execute("Select 编号,产品,规格,开始生产时间,完成生产时间 from 信息 order by 编号")
r = Range("A65536").End(3).Row
For i = 2 To r
For j = 6 To 12
Cells(i, j).CopyFromRecordset conn.Execute("Select sum(物料数量) as sumSL from 生产消耗 where left(生产编号,4)='" & Cells(i, "A") & "' and 物料名称='" & Cells(1, j) & "'")
Next j
Next i
Range("F2").Resize(r, 7).NumberFormatLocal = "G/通用格式"
End Sub |
评分
-
2
查看全部评分
-
|