Hello guys, I would like to know how to use the SQL command “UPDATE” merged with libreoffice basic command. Since I want to update the record and a table (Diagnostic Dates) to the same value shown in the text box (from the “Identification” table).
This is the code I made so far (the error is in the last line):
if IsNull(ThisDatabaseDocument.CurrentController.ActiveConnection) then
ThisDatabaseDocument.CurrentController.connect
endif
Dim oForm, oCtrlr, oField As Object
oForm = ThisComponent.Drawpage.Forms.getByName("Formulário")
oCtrlr = ThisComponent.getCurrentController()
oField = oForm.GetByName("Caixa de texto 1")
oCtrlr.getControl(oField).setFocus()
Dim oStatement As Object
oStatement = ThisDatabaseDocument.CurrentController.ActiveConnection.createStatement()
oStatement.execute("UPDATE ""Datas do Diagnostico"" SET ""IDAnamnese"" = "+ oField +" ")