The purpose of the app is to execute and run a bo report from within Access 2003 and load the report data into an Access table. The code runs nicely on 2 different systems. We installed it on a new system and we get the dreaded c000005 error message on the “set boapp = nothing” statement. Any ideas?
Error message:
Unhandled Exception
Code: c0000005
Description: EXCEPTION_ACCESS_VIOLATION
Code:
Dim BOApp As busobj.Application
Dim doc As busobj.Document
Dim DataProv As busobj.DataProvider
Dim i As Long, j As Long
Dim outcome As String
Dim actOutcome As String
Dim tarBusName As String
Dim curSnapDate As Long
Dim curWeekEndSnapDate As Long
Dim selectStr As String
Const boOffline = True
Const boRefresh = False
Set rsSnapWa = CurrentDb.OpenRecordset("snapWorkArea")
'Initialize snapshot work area
DoCmd.SetWarnings False
DoCmd.RunSQL “delete from snapWorkArea”
DoCmd.SetWarnings True
'Import snapshot detail data
Set BOApp = New busobj.Application
BOApp.Visible = False
BOApp.Interactive = False
success = addEvent(“Business Objects Document Open Started”, jobId, True)
Call BOApp.LoginAs(“userName”, “pWord”, boOffline)
Set doc = BOApp.Documents.Open("C:\reuSys\reSnap1.rep")
success = addEvent("Business Objects Document Open Completed", jobId, True)
Set DataProv = doc.DataProviders(1)
If boOffline = False And boRefresh = True Then
success = addEvent("Business Objects Report Refresh Started", jobId, True)
doc.DataProviders(1).Refresh
success = addEvent("Business Objects Report Refresh Completed", jobId, True)
End If
Set bocol1 = DataProv.Columns(1)
Set bocol2 = DataProv.Columns(2)
Set bocol3 = DataProv.Columns(3)
Set bocol4 = DataProv.Columns(4)
Set bocol5 = DataProv.Columns(5)
Set bocol6 = DataProv.Columns(6)
Set bocol7 = DataProv.Columns(7)
Set bocol8 = DataProv.Columns(8)
Set bocol9 = DataProv.Columns(9)
Set bocol10 = DataProv.Columns(10)
Set bocol11 = DataProv.Columns(11)
Set bocol12 = DataProv.Columns(12)
Set bocol13 = DataProv.Columns(13)
Set bocol14 = DataProv.Columns(14)
Set bocol15 = DataProv.Columns(15)
Set bocol16 = DataProv.Columns(16)
Set bocol17 = DataProv.Columns(17)
Set bocol18 = DataProv.Columns(18)
Set bocol19 = DataProv.Columns(19)
Set bocol20 = DataProv.Columns(20)
Set bocol21 = DataProv.Columns(21)
Set bocol22 = DataProv.Columns(22)
Set bocol23 = DataProv.Columns(23)
Set bocol24 = DataProv.Columns(24)
For i = 1 To DataProv.Columns(1).Count
outcome = ""
rsSnapWa.AddNew
rsSnapWa("account") = bocol1(i)
rsSnapWa("primarySource") = bocol2(i)
rsSnapWa("closeDateSid") = Format(bocol3(i), "yyyymmdd")
If IsNull(bocol4(i)) Then
outcome = "##empty"
Else
outcome = bocol4(i)
End If
rsSnapWa("outcome") = outcome
rsSnapWa("outcomeDetail") = outcome
rsSnapWa("recCount") = bocol5(i)
rsSnapWa("onceOffRevLocal") = bocol6(i)
rsSnapWa("recurrRevLocal") = bocol7(i)
rsSnapWa("amLogin") = bocol8(i)
rsSnapWa("fgaFamilyCode") = bocol9(i)
rsSnapWa("am") = bocol10(i)
rsSnapWa("accountCountryCode") = bocol11(i)
rsSnapWa("accountCountry") = bocol12(i)
rsSnapWa("oppId") = bocol13(i)
rsSnapWa("oppName") = bocol14(i)
rsSnapWa("oppSalesStage") = bocol15(i)
rsSnapWa("oppDaysActive") = bocol16(i)
rsSnapWa("primarySalesExecLName") = bocol17(i)
rsSnapWa("primarySalesExecFName") = bocol18(i)
rsSnapWa("oppProb") = bocol19(i)
rsSnapWa("recurrRev") = bocol20(i)
rsSnapWa("onceOffRev") = bocol21(i)
rsSnapWa("salesProcess") = bocol22(i)
rsSnapWa("localCurrency") = bocol23(i)
rsSnapWa("oppType") = bocol24(i)
rsSnapWa.Update
Next i
BOApp.Quit
Set BOApp = Nothing
'Transform Outcome
DoCmd.SetWarnings False
DoCmd.RunSQL “UPDATE snapWorkArea INNER JOIN outcomeMap ON snapWorkArea.outcome = outcomeMap.outcomeFrom SET snapWorkArea.outcome = outcomeMap.outcomeTo”
DoCmd.SetWarnings True
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE snapWorkArea INNER JOIN oppTypeMap ON snapWorkArea.oppType = oppTypeMap.oppType SET snapWorkArea.oppType = oppTypeMap.revisedType"
DoCmd.SetWarnings True
Set db = Nothing
CurrentDb.Close
dmontella (BOB member since 2004-07-15)