Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Integrate Business Objects with VB 6.0

Posted on 2003-10-24
4
Medium Priority
?
571 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 1000 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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

926 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