05-01-2009 10:19 AM
Hi all.
We have a datagrid whose source is a custom table. The user can update the value in the datagrid via a pick list. I want to be able to also add that value chosen to a USERFIELD in the ACCOUNT table.
I added an AXFormAfterPost event to the datagrid and now I get the following error:
The statement has been terminated. : Cannot insert the value NULL into column 'SECCODEID', table 'mydb.sysdba.ACCOUNT'; column does not allow nulls. INSERT fails.
at line 13, char 2 (in the code below it is this code: objRS.Update)
Below is the code:
========================================================
'Including Script - SystemLX Database Support
option explicit
Sub AXFormAfterPost(Sender)
Dim objRS
Dim objSLXDB
Set objSLXDB = New SLX_DB
Set objRS = objSLXDB.GetNewRecordSet
objRS.Open "Select A.USERFIELD10 From ACCOUNT A Where A.ACCOUNTID = '" & application.BasicFunctions.CurrentAccountID & "'", objSLXDB.Connection 'DNL
objRS.AddNew
objRS.Fields("USERFIELD10").Value = Picklist1.Text
objRS.Update
objRS.Close
Set objRS1 = Nothing
End Sub
========================================
What am I missing?
Thank you in advance.
SLX LAN 7.2.1
Solved! Go to Solution.
05-01-2009 11:08 AM
I think you are doing something else somewhere else and this is not the right bit of code/line. Check for an insert into account table - as this looks like where the error is (appreciate you may think it's here etc - but that's a select, not an insert).
05-02-2009 06:49 AM
Thanks Mike.
I removed the .AddNew and it worked fine.