How can I Update a Data Base column with Basic Macro?

Edited:

.
.

AtribuiCategoria(oForm As Object)
Dim vResult As Long			'	Return value
Dim oResultAs As Object	'	com.sun.star.sdbc.XResultSet
Dim oQuery As Object			'	com.sun.star.ucb.XContent
Dim oStatement As Object
Dim xStatement As Object 		'	com.sun.star.sdbc.XStatement

	xStatement = CreateUnoService("com.sun.star.sdbc.XStatement")
   	Context = CreateUnoService("com.sun.star.sdbc.DatabaseContext")
   	oResult = CreateUnoService("com.sun.star.XResultSet")
   	oQuery = CreateUnoService("com.sun.star.XContent")


Dim sSql As String				'	SQL statement
Dim bDirect					'	Alias of DirectSQL
Dim tbDespesasCC As String
Dim tbCategoria As String
Dim fldCategoria As String 
Dim fldIDCategoria As String


 	tbDespesasCC = "Despesas Conta Corrente"
	tbCategoria = "Categoria"
	fldCategoria = "Categoria"
	fldIDCategoria = "ID Categoria" 

	'	Execute command

	sSQL = "UPDATE tbDespesasCC SET Categoria = fldIDCategoria.Categoria"
	VResult = ExecuteSQL(sSql)
REM 	oStatement = con.prepareStatement(sSql)
REM Set oResult = _ExecuteSql(sSql, bDirect)
REM	If IsNull(oResult) Then GoTo Finally
	
END SUB

Edited question for clarity. Please use Formatted Text icon on toolbar for this.

Hello,

Your question does not state where you are executing the macro from. oForm as an parameter and not seen as used anywhere. Don’t know what database you are using so will guess it is HSQLDB embedded. This matters as for SQL.

SQL field and table names when mixed case need to be surrounded by quotes and in a string by double quotes. You do not ExecuteSQL(... but in this case executeUpdate(...

For an example of this, see this post → How to create a macro for use in base form via a button?