Hi all,
I'm trying to create a revision to form. The dw object and control are identical... I'm just changing a couple of values and changing the row status to NewModified! to force an INSERT instead of an UPDATE.
// Create new Workorder
ll_NewWO = f_get_workorder_id( 1 )
if ll_NewWO < 0 then return
idw_1.SetItem(1, "workorder_id", ll_NewWO)
idw_1.SetItem(1, "revision_to", il_FormID)
idw_1.SetItem(1, "revision_by", sqlca.logid)
idw_1.SetItem(1, "revision_date", DateTime(Today(), Now()) )
idw_1.SetItem(1, "revision_reason", ls_reason )
idw_1.SetItem(1,"lab_complete", 'F')
idw_1.SetItemStatus(1, 0, Primary!, NewModified!)
li_rc = idw_1.Update(TRUE, TRUE)
if li_rc = -1 then
MessageBox("wo update", li_rc)
return
end if
The "workorder_id" column is the primary key, int in the table. "Revision_date" is a smalldatetime in the table. Database is SQL Server 2012. Using a Microsoft ODBC driver. I sprinkled a bunch of Message boxes to double check the values I am setting, everything looks good. INSERT statement seems to be created correctly. Here's the error I'm getting:
I don't know how to get the values to show up, it's always question marks. Despite the error, everything displays properly in the dw.
It just seems like changing a few fields and forcing an INSERT should do the trick. Any ideas would be appreciated... I might have to break down and write a function to manually insert a new record... This method is so much more convenient and easy to read!
~~~Tracy