|
本帖最后由 aslxt 于 2009-11-11 13:46 编辑
1、新建模块
Option Compare Database
Function PP(ByVal NM As String, ByVal DW As String) As String
Select Case NM
Case "加热线"
Select Case DW
Case "M"
PP = "加热线"
Case "KG"
PP = "加热线"
Case Else
PP = "加热线加工"
End Select
Case "检知线"
PP = "加热线"
Case "电缆线*"
PP = "电缆线加工"
Case Else
PP = "加热线加工"
End Select
End Function
Function LX(ByVal NM As String, ByVal DW As String, ByVal GG As String) As String
Select Case GG
Case "SATA*"
LX = "Toshiba"
Case "*TXJ*"
LX = "Psnasonic"
Case "*HDMI*"
LX = "Psnasonic"
Case "DUMM*"
LX = "Psnasonic"
Case "*EF*"
LX = "Hitachi"
Case Else
Select Case NM
Case "加热线"
Select Case DW
Case "M"
LX = "加热线"
Case "KG"
LX = "加热线半成品"
Case "PC"
LX = "毛布"
Case Else
LX = "Sony"
End Select
Case "检知线"
LX = "加热线"
Case "黄色导线"
LX = "毛布"
Case "毛布"
LX = "毛布"
Case "ヒーター取付具組"
LX = "便座"
Case "便座"
LX = "便座"
Case "传感加热器"
LX = "便座"
Case Else
LX = "Sony"
End Select
End Select
End Function
2、新建查询
INSERT INTO 期初在库 ( 仓库编码, 存货编码, 存货名称, 规格型号, 生产线, 主计量单位, 现存数量, 品番, 类型 )
SELECT zaikolist.仓库编码, zaikolist.存货编码, zaikolist.存货名称, zaikolist.规格型号, zaikolist.生产线, zaikolist.主计量单位, zaikolist.现存数量, PP([存货名称],nz([主计量单位],"")) AS 品番, LX([存货名称],[主计量单位],nz([规格型号],"")) AS 类型
FROM zaikolist
WHERE (((zaikolist.仓库编码)="01" Or (zaikolist.仓库编码)="02" Or (zaikolist.仓库编码)="03" Or (zaikolist.仓库编码)="22"));
3、运行查询
ok?
注意:类型的字段是首先根据规格型号、然后到名称、计量单位这样的顺序判断,如果不符合你的意图,可以修改模块以达到你的目的 |
|