Try putting the code in the FinishReport event of the report (at the top-level).
We do things where we update or insert records into the database from Actuate reports.
I believe that the Actuate Encyclopaedia has had service pack 2 installed and so the code for updating the database had to be modified.
I have this code in the FinishReport Sub:
Sub FinishReport( )
Super::FinishReport( )
Dim position as integer
Dim stmt As AcDBStatement
Dim cursor As AcDBCursor
Dim newConnection As AcDBConnection
Dim strCommit as String
Dim strSQL As String
Dim aRow As AcDataRow
Dim msg as string
Dim nl as string
nl = chr$(10)
Set newConnection=New Connection
newConnection.connect
If (newConnection.IsOpen) Then
for position = lbound(arrayGeneric,1) to ubound(arrayGeneric,1)
strSQL = "UPDATE " & Schema & ".INVRESERVE"
strSQL = strSQL & " SET picklistno=" & glngPickListNo
strSQL = strSQL & ",picklistqty=" & arraygeneric(position,1)
strSQL = strSQL & " where rowid ='" & arraygeneric(position,0) & "'"
Set stmt = New AcDBStatement(newConnection)
stmt.prepare(strSQL)
If not stmt.execute() Then
newConnection.raiseError()
Set stmt = Nothing
exit sub
End If
Set stmt = Nothing
Next
strCommit = "COMMIT"
Set stmt = New AcDBStatement(newConnection)
stmt.prepare(strCommit)
If Not (stmt.execute()) Then
newConnection.raiseError()
End If
End if
End Sub
The array arrayGeneric is populated in the OnRow Sub of the frame where records are displayed:
Sub OnRow( row As AcDataRow )
ReDim Preserve arrayGeneric(i,1)
Super::OnRow( row )
arrayGeneric (i,0) = row.GetValue("strROWID")
arrayGeneric (i,1) = row.GetValue("INVRESERVE_COMMITTEDQTY")
i = i+1
End Sub
Hope this helps some.
Pete