|
本帖最后由 Benjamin_luk 于 2016-12-6 00:29 编辑
方法:
1.读取了窗体中的记录集,取得“M“的产品
2.将”M”产品加入到临时表tblSKUtemp
3.用追加查询SQL_ExtBOM,将BOM资料加到表tblTempBOM_Breakformula里面
问题,
1.如果产品是“B”是否需要加到表tblTempBOM_Breakformula里面
2.可能BOM第二层还会有半成品; 如果还需要导的话,代码需要修改。
Private Sub Extract_Click()
Dim rs As Recordset, str As String, rs1 As Recordset
Dim I As Integer, K As Integer
Set rs = frmSubcheckBOMDetail.Form.Recordset
K = 0
If rs.RecordCount > 0 Then
rs.MoveFirst
CurrentDb.Execute "Delete * from tblSKUTemp"
CurrentDb.Execute "Delete * from tblTempBOM_Breakformula"
Set rs1 = CurrentDb.OpenRecordset("tblSKUTemp")
Do Until rs.EOF
If rs("子项属性MB") = "M" Then
rs1.AddNew
rs1("SubSKU") = rs("子项")
rs1.Update
K = K + 1
End If
rs.MoveNext
Loop
If K > 0 Then
DoCmd.OpenQuery "SQL_ExtBOM"
MsgBox "BOM导出完成"
Else
MsgBox "没有需要生产的半成品"
End If
End If
End Sub
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|