From a macro, I want to insert the text contained in a variable named sHLink in a column of a table of a form for a record in use using an SQL command.
.
The TActors table of a form named Actors contains a column named Link_X and a column named IDActor.
.
In the form, there is a field named fmt-IDActor associated with the IDActor data field and a field named txt-HLink associated with the Link_X data field.
.
The current record ID was previously placed in a variable named sRecordID. The sHLink variable has been initialized and contains String type information.
.
The following error is generated:
BASIC runtime error.
Property or method not found: ExecuteSQL.
.
oDb = com.sun.star.sdbc.drivers.OConnectionWrapper
sSQL = expected value
.
Could someone help me with this?
.
Here is the code:
Sub InsertText
Dim sName as String
Dim sRecordID as Integer
...
There was some work done before this section appeared
...
' New variables
Dim oDb as Object
Dim sSQL as String
Dim sHLink as String
' I want to make sure the database is available
oDb = ThisDatabaseDocument.CurrentController.ActiveConnection
' sHLink content
sHLink = "There is some text here combined with this String variable" & sName
' SQL command content ' Try this one
sSQL = "UPDATE TActors SET Link_X = " & sHLink & " WHERE IDActor = " & sRecordID
' And try this one
sSQL = "UPDATE ""TActors "" SET ""Link_X"" = " & sHLink & " WHERE ""IDActor"" = " & sRecordID
oDb.ExecuteSQL(sSQL) ' ERROR Property or method not found: ExecuteSQL
End Sub