Solved

Integrate Business Objects with VB 6.0

Posted on 2003-10-24
4
545 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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