Hello all,
I’ve been using some macros to automate certain SQL statements with the following code:
sub executeSQLcmd(SQLcmd as String)
Dim oStatement As Object
if IsNull(ThisComponent.CurrentController.ActiveConnection) then
ThisComponent.CurrentController.connect
endif
oStatement = ThisComponent.CurrentController.ActiveConnection.createStatement()
oStatement.execute(SQLcmd)
end sub
I’ve always used Tools > Macros > Execute to get the job done but I grew tired of this and tried to assign some buttons in a simple form to do the same but without success. The BASIC interpreter throws an exception at the line if IsNull(ThisComponent.CurrentController.ActiveConnection) then
and says ActiveConnection
is not found.
Perhaps there’s no ActiveConnection to be found in a Form? If so, what’s the better alternative to the class ThisComponent.CurrentController
?