Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Copper Elite Contributor
Posts: 72
Registered: ‎04-01-2009
Accepted Solution

Cannot insert the value NULL into column 'SECCODEID'

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 - SystemSmiley FrustratedLX 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

Highlighted
Silver Super Contributor
Posts: 801
Registered: ‎03-24-2009

Re: Cannot insert the value NULL into column 'SECCODEID'

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).

 

Highlighted
Copper Elite Contributor
Posts: 72
Registered: ‎04-01-2009

Re: Cannot insert the value NULL into column 'SECCODEID'

Thanks Mike.

 

I removed the .AddNew and it worked fine.