Hello,
I have a function that copies records from one table to another table, this works well, but it also inserts blank records and I am not sure how to stop this.
any advice is greatly appreciated!!
I have a function that copies records from one table to another table, this works well, but it also inserts blank records and I am not sure how to stop this.
any advice is greatly appreciated!!
Code:
Function BeforeProcessMenu(conn)
set dal_mbcnrpx3=dal.Table("mbcnrpx3")
set dal_pick=dal.Table("pick")
set rstmp = dal_mbcnrpx3.QueryAll()
set rstmp01 = dal_pick.QueryAll()
sql="select CNKZNB from mbcnrpx3"
set rsExistsCU=CustomQuery(sql)
if rsExistsCU.eof then
sqlInsert="Update pick set Pick_list='"& CNKZNB &"' where '"& CNKZNB &"'<>''"
CustomQuery(sqlInsert)
end if
rsExistsCU.close
set rsExistsCU=nothing
while not rstmp.eof
'add each record from mbcnrpx3 table to the pick table
set rsExist = dal_pick.Query("Pick_list=" & rstmp("CNKZNB") & " and Order_Num='" & rstmp("CNCVNB") & "'","")
if rsExist.eof then
dal_pick.Item_Num=rstmp("CNAITX")
dal_pick.Pick_list=rstmp("CNKZNB")
dal_pick.Order_Num=rstmp("CNCVNB")
dal_pick.Create_date=rstmp("CNALDT")
dal_pick.Create_time=rstmp("CNABTM")
dal_pick.pick_qty=rstmp("CNANQT")
end if
dal_pick.Add()
set rsExist = nothing
rstmp.movenext
wend
set rstmp=nothing
End Function