Working on a script to track the changes in BM_BillHeader and BM_BillDetail. I have the following script to update a UDT on a post-write from those tables. My goal is to add the line to the UDT. However, I am running into a date format error (attached is a screenshot of the error). Any ideas or suggestions would be greatly appreciated!
retVal = 0
oAudit = 0
sChangeDate = FormatDate(oSession.SystemDate)
sTime = FormatDate(Now,vbLongTime)
sUser = oSession.UserCode
sItemCode = ""
sOrigQty = ""
sBillNo = ""
sRevNo = ""
sLineKey = ""
oAudit = oSession.AsObject(oSession.GetObject("CM_UDTMaint_bus", "BM_UDT_BOM_AUDIT"))
if oAudit <> 0 Then
Set oAudit = oScript.AsObject(oAudit)
retVal = oBusObj.GetValue("LineKey$",sLineKey)
retVal = oBusObj.GetValue("BillNo$", sBillNo)
retVal = oBusObj.GetValue("QuantityPerBill$", sOrigQty)
retVal = oBusObj.GetValue("ComponentItemCode&", sItemCode)
retVal = oAudit.setKey(sBillNo & sLineKey & sChangeDate & sTime)
retVal = oAudit.SetValue("UDF_CHANGE_DATE$",sChangeDate)
retVal = oAudit.SetValue("UDF_ORIGNAL_DATE$",sChangeDate)
retVal = oAudit.SetValue("UDF_ORIG_ITEM$", sItemCode)
retVal = oAudit.SetValue("UDF_ORIG_LINKEY$",sLineKey)
retVal = oAudit.SetValue("UDF_ORIG_QTY$",sOrigQty)
retVal = oAudit.SetValue("UDF_USER&",sUser)
retVal = oAudit.Write()
End If
------------------------------
John Shaver
Chief Value Officer
Axiology
Knoxville TN
(865) 389-3600
------------------------------