Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Report opening and refreshing inconsistencies through VBA

Report opening and refreshing inconsistencies through VBA

Report opening and refreshing inconsistencies through VBA

Too anyone willing to help me out, here is my issue.

I've written VBA code to automatically login to BO, open a report/document, refresh it and send the results via the ExportAsText method. (I've posted the code at the bottom)

My issue is this: The opening and refreshing of the report is not only inconsistent, but sometimes errors out. The companies BO software is used to manage data from an Oracle Data Warehouse. There have been some know performance issues, but I don't believe it's what is causing this issue.

The most glaring situation is a user attempts to the pull the data, the report takes extremely long to open, and then when it refreshes, the error:

Error #: -2147417856 Automation error, System call failed

I am just having trouble identifying the reason...the only two lines of code that run are the open and refresh, so it must be one of them. Thing is it doesn't happen every time.

My thought is A) determine why this is happening and fix the problem or B) find a way to schedule the reports nightly (they don't have BCA, by the way)

This is all being done using Access 97. (I had no choice)

One more thing, i don't neccessarily need a solution here, just some thoughts on why this is happening, so that I can effectively direct and advise my client.

Thanks a bunch in advance.


Dim Obj_BOApp As busobj.Application
Dim Obj_BODocOrders As busobj.Document
Dim Obj_BORepOrders As busobj.Report

On Error GoTo ErrorHandle
'On Error Resume Next
Set Obj_BOApp = New busobj.Application
Obj_BOApp.Visible = False
Obj_BOApp.Interactive = False
Call Obj_BOApp.LoginAs("MSA1818", "testing", False)

Me!DataUpdateStatus = "Running Orders Report"

' Run Orders Report
Set Obj_BODocOrders = Obj_BOApp.Documents.Open(OrdersReportName, False, False)
Me!DataUpdateStatus = "Writing IncomingOrders.txt to network drive."

' Export Orders Report
Set Obj_BORepOrders = Obj_BODocOrders.ActiveReport
Obj_BORepOrders.ExportAsText ("\\IncomingOrders.txt")
'Obj_BORepOrders.ExportAsText ("\\IncomingOrders_" + VBA.CStr(VBA.Month(VBA.Date)) + "_" + VBA.CStr(VBA.Day(VBA.Date)) + "_" + VBA.CStr(VBA.Year(VBA.Date)) + "_" + VBA.CStr(VBA.Hour(VBA.Time)) + VBA.CStr(VBA.Minute(VBA.Time)) + ".txt")
Set Obj_BORepOrders = Nothing
Set Obj_BODocOrders = Nothing

Set Obj_BOApp = Nothing

Exit Sub

Call MsgBox("Orders Error#: " + CStr(Err.Number) + Chr(13) + "The following error has occured after attempting to run the Business Object Reports: " + Chr(13) + Err.Description + Chr(13) + "Please try again later and remove the BUSOBJ.EXE from your PC's current processes.", vbCritical)
Set Obj_BOApp = Nothing
Me!ProcessCheck = "Nothing"
Exit Sub

RE: Report opening and refreshing inconsistencies through VBA

Just wanted update this in case anybody else runs into this issue.

It was suggested that I eliminate Access from the refreshing of the reports.  I set the report to refresh on open, and put some code in the AfterRefresh even to export the data to text.  I'll update this after i've tested it all out...

RE: Report opening and refreshing inconsistencies through VBA

I do something very similar to this, but i've got no where near the amount of code your using, dunno if it's any use but here is what i'm using:

Private Sub Document_Open()
Application.BreakOnVBAError = False
Application.Interactive = False

Dim doc As Document
Dim rep As Report

Set doc = Application.Documents.Item(1)
Set rep = doc.Reports.Item(1)

rep.ExportAsText ("File path goes here")
End Sub

I run this overnight and never gat any error issues

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close