To All,
The document 'How to Access to a database from VBA" is available from the Business Objects tech support site www.techsupport.businessobjects.com I opened a request for information and the document was emailed to me.
Here’s an example of accessing an Oracle database that I added to the version of the document sent to me. Hope this helps.
Mike McErlain
McErlain Consulting
MikeMcErlain@Netscape.net
'Actual Code that worked in an Oracle 7.3/8 environment: '*************************************************************************** ’ Note: To build this code I had to first download and set up the ActiveX * ’ Data Objects source from the Microsoft website. Modules downloaded were * ’ “dcom95.exe” (for win95 environment) and “mdac_typ.exe”. *
'***************************************************************************
PostStartStatus:
'*************************************************************************** '* Post a status record in the processing status table *
'*************************************************************************** Dim ThisReport As Document
Dim ADOconn As New ADODB.Connection
Dim ADORecSet As New ADODB.Recordset
Dim SqlStmt As String
With ADOconn 'Set up database connection
.Provider = “msdaora”
.CursorLocation = adUseClient
.ConnectionString = “User ID=developer;PASSWORD=devlpass;Data Source=ORADEV”
End With
ADOconn.Open 'Open the connection to the database
SqlStmt = “delete from REPORT_STATUS where process_name = '” ‘build sql stmt
SqlStmt = SqlStmt & ThisReport.Name & "’" 'Add report name to stmt
ADORecSet.Open SqlStmt, ADOconn, adOpenDynamic 'Execute the SQL statement
SqlStmt = "Insert into REPORT_STATUS "
SqlStmt = SqlStmt &
“(process_name,process_status,process_started,update_by) values (’”
SqlStmt = SqlStmt & ThisReport.Name
SqlStmt = SqlStmt & “’,‘Started’,sysdate,‘Macro’)”
ADORecSet.Open SqlStmt, ADOconn, adOpenDynamic 'Execute the SQL
statement
ADOconn.CommitTrans
ADOconn.Close
Listserv Archives (BOB member since 2002-06-25)