Solved

Integrate Business Objects with VB 6.0

Posted on 2003-10-24
4
554 Views
Last Modified: 2011-04-14
Hi Experts
I am using Business Objects to generate reports. My problem is, Is there any VB DLL's or ActiveX controls that i can use to create these reports programatically.

Thanx
0
Comment
Question by:dayandealwis
4 Comments
 
LVL 5

Accepted Solution

by:
rajaamirapu earned 250 total points
ID: 9613147
Use Business objects Libarary busobj.tlb
dim app1 as New busobj.Application

Set app1 = New busobj.Application
app1.Visible = False
app1.LoginAs "System", "manager"
Set doc = app1.Documents.Open("yourpath\yourdocumentname")

See boudgen.hlp for more info
0
 
LVL 3

Assisted Solution

by:crimper
crimper earned 250 total points
ID: 9614427
Three procedures below might help get you started - these are excel based, but if you know your way round code, will be simple to modify....

Sub RunReport1()
    Dim StrStartWk As String
    Dim StrEndWk As String
    Dim strSQL As String
    Dim vnt As Variant
   
    StrStartWk = Range("PrevWeek")
    StrEndWk = Range("LastWeek")
   
    strSQL = "SELECT BRANCH.BRANCH_CODE,BRANCH.REGION_NAME,BRANCH.BRANCH_NAME, " & _
      "Time.REPORTED_WEEK , DEPARTMENT.DEPARTMENT_CODE, DEPARTMENT.DEPARTMENT_NAME, " & _
      "Sum(DEPTSALES.TAKINGSU), Sum(DEPTSALES.TAKINGSV) " & _
      "FROM BRANCH,TIME,DEPARTMENT,DEPTSALES " & _
      "WHERE ( BRANCH.BRANCH_CODE=DEPTSALES.BRANCH_CODE  ) " & _
      "AND  ( DEPTSALES.DEPT=DEPARTMENT.DEPARTMENT_CODE  ) " & _
      "AND  ( DEPTSALES.WEEK=TIME.WEEK  ) " & _
      "AND  ( TIME.REPORTED_WEEK  BETWEEN  '" & StrStartWk & "' AND '" & StrEndWk & "' " & _
      "AND  ( BRANCH.CLOSED_DATE  IS NULL  ) " & _
      "AND  DEPARTMENT.DEPARTMENT_CODE  IN  ('492','493','494','495','496') ) " & _
      "Group BY BRANCH.BRANCH_CODE,BRANCH.REGION_NAME,BRANCH.BRANCH_NAME,TIME.REPORTED_WEEK, " & _
      "DEPARTMENT.DEPARTMENT_CODE,DEPARTMENT.DEPARTMENT_NAME;"
   
    vnt = MISDataCollect(strSQL)
   
    If Not IsEmpty(vnt) Then
        Range("MIS1").Resize(UBound(vnt, 1) + 1, UBound(vnt, 2) + 1) = vnt
    End If
End Sub

'***************
'MISDataCollect
'Purpose:       Retrieves the results of a SQL statement from MIS
'               into a 2 dimensional array.
'Inputs:        SQL = SQL statement to execute
'               TimeOut = (optional) Period of time (in seconds) the
'                SQL statement should be allowed to execute before timing out.
'                If not specified 180 seconds is taken as default.
'Returns:       A 2 dimensional array of data
'***************
Public Function MISDataCollect(SQL As String, Optional TimeOut As Integer = 180) As Variant
    On Error GoTo errorHandle
    '------------------------
    Dim daoWS As DAO.Workspace
    Dim daoCn As DAO.Connection
    Dim daoRS As DAO.Recordset
   
    'Open the MIS connection
    Set daoWS = CreateWorkspace("misprd", "mars_end_user", "mars", dbUseODBC)
    Set daoCn = daoWS.OpenConnection _
          (Name:="misprd", Connect:="ODBC;DSN=misprd;UID=mars_end_user;PWD=mars", ReadOnly:=True)
    daoCn.QueryTimeout = TimeOut
   
    'Get the SQL into a recordset
    Set daoRS = daoCn.OpenRecordset(SQL)
   
    'Place the recordset into a array.
    If Not daoRS.EOF And Not daoRS.BOF Then
        MISDataCollect = Transpose(daoRS.GetRows(65000))
    End If

    daoRS.Close
    daoCn.Close
   
ExitProc:
    Set daoWS = Nothing
    Set daoCn = Nothing
    Set daoRS = Nothing
    Exit Function
   
errorHandle:
    Dim e As Integer
    e = MsgBox(Err.Number & ": " & Err.Description, vbRetryCancel)
    If e = vbCancel Then Resume ExitProc Else Resume
End Function


Public Function Transpose(vntData As Variant) As Variant
    Dim r As Long
    Dim c As Long
    Dim vnt As Variant
   
    ReDim vnt(LBound(vntData, 2) To UBound(vntData, 2), LBound(vntData, 1) To UBound(vntData, 1))

    For r = LBound(vntData, 2) To UBound(vntData, 2)
        For c = LBound(vntData, 1) To UBound(vntData, 1)
            vnt(r, c) = vntData(c, r)
        Next
    Next
     
    Transpose = vnt
End Function



Second procedure actually collects data from BusObjs - first query simply passes in SQL statement which is your query.
You can get this sql as you build a report in BusObj's.

Third procedure is simply a transposing function as I could not get excels one to work....


Hope this helps....


JP


Oh and need the Microsoft DAO 3.51 Object library in the references.

0
 
LVL 27

Expert Comment

by:planocz
ID: 10183471
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
No response from dayandealwis from 10/24/2003 comment
Award points to rajaamirapu(50%) and crimper(50%) is recommend.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

planocz
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA Shell can't Find Word document 11 125
how to know if my Checkbox is True in VB6.0? 9 65
MsgBox 4 71
Export Data to Different .csv Files 26 121
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question