Problem when Insert data using OO40
Hi
In the Company that I work, They use OO40 Objects, I trying to insert data inside table , but return error Like
had passing null
See piece of code
Code:
....
. If Not bTransCancel Then
' Clear the database error buffer before database operation
gDatabase.LastServerErrReset
' Add the values in the property sheet to the dynaset
mdysINTEGRA_88STIFNF_Base.DbAddNew
mdysINTEGRA_88STIFNF_Base.Fields("ANO_MES_REFERENCIA_88STITNF").Value = Format(DTAnoMes_Ref, "yyyymm")
mdysINTEGRA_88STIFNF_Base.Fields("EST_CODIGO").Value = txtEST_CODIGO.Text
mdysINTEGRA_88STIFNF_Base.Fields("REMETENTE_PFJ_CODIGO").Value = txtREMETENTE_PFJ_CODIGO.Text
mdysINTEGRA_88STIFNF_Base.Fields("MDOF_CODIGO").Value = txtMDOF_CODIGO.Text
mdysINTEGRA_88STIFNF_Base.Fields("SERIE_SUBSERIE").Value = txtSERIE_SUBSERIE.Text
mdysINTEGRA_88STIFNF_Base.Fields("NUMERO").Value = txtNUMERO.Text
mdysINTEGRA_88STIFNF_Base.Fields("DT_EMISSAO").Value = txtDT_EMISSAO.Text
mdysINTEGRA_88STIFNF_Base.Fields("DT_ENTRADA").Value = CDate(Format(txtDT_ENTRADA.Text, "DD/MM/YYYY"))
mdysINTEGRA_88STIFNF_Base.Fields("IDF_NUM").Value = txtIDF_NUM
mdysINTEGRA_88STIFNF_Base.Fields("MERC_CODIGO").Value = txtMERC_CODIGO
mdysINTEGRA_88STIFNF_Base.Fields("CFOP_CODIGO").Value = txtCFOP_CODIGO.Text
mdysINTEGRA_88STIFNF_Base.Fields("CST_CODIGO").Value = txtCST_CODIGO.Text
mdysINTEGRA_88STIFNF_Base.Fields("QUANTIDADE").Value = txtQUANTIDADE.Text
mdysINTEGRA_88STIFNF_Base.Fields("VL_BRUTO_PROD").Value = txtVL_BRUTO_PROD.Text
mdysINTEGRA_88STIFNF_Base.Fields("VL_DESCONTO").Value = txtVL_DESCONTO.Text
mdysINTEGRA_88STIFNF_Base.Fields("VL_BASE_ICMS_OP").Value = txtVL_BASE_ICMS_OP.Text
mdysINTEGRA_88STIFNF_Base.Fields("ALIQ_ICMS_OP").Value = txtALIQ_ICMS_OP.Text
mdysINTEGRA_88STIFNF_Base.Fields("VL_BASE_ICMS_ST").Value = txtVL_BASE_ICMS_ST
mdysINTEGRA_88STIFNF_Base.Fields("ALIQ_ICMS_ST").Value = txtALIQ_ICMS_ST
mdysINTEGRA_88STIFNF_Base.Fields("VL_IPI").Value = txtVL_IPI.Text
' mdysINTEGRA_88STIFNF_Base.Fields(6).Value = CDate(Format(txtDT_EMISSAO.Text, "DD/MM/YYYY"))
mdysINTEGRA_88STIFNF_Base.DbUpdate
see error:
SQL execution error, ORA-01400: não é possível inserir NULL em ("FISDEV"."FIS_ITEM_SINTEGRA_MG_88STITNF"."DT_EMISSAO")
But before command mdysINTEGRA_88STIFNF_Base.DbUpdate, I see in immediate window
? mdysINTEGRA_88STIFNF_Base.Fields("DT_EMISSAO").value
27/04/2015
Somebody can help me ?
Tia
Re: Problem when Insert data using OO40
maybe you need to convert the string to a date as is done in the line below?