I’ve created a Crystal Report (v10) and am now trying to create a macro within ACCPAC (53A) that when ran, displays the report using data from the company that the user is logged in under.
In the report, I’ve created the following Parameter Fields
-CMPNAME
-PATH
-EXT
-DATE
I saved the report under ACCPAC\AR53A\ENG
I modified the arrpt.ini file by adding the following at the bottom of the file
'************** Testing ********************
[ARREPORT]
heading="Test Report"
crystal= ARREPORT
orientation=portrait
paper size=1
optparams=1
2=DATE STRING
Then I created the following macro
Sub MainSub()
On Error GoTo ACCPACErrorHandler
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim rptObj As AccpacCOMAPI.AccpacReport
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Set rptObj = mDBLinkCmpRW.Session.ReportSelect("ARREPORT", "", "")
rptObj.SetParam "DATE", "20060601"
rptObj.PrintDestination = PD_PREVIEW
rptObj.PrintReport
Exit Sub
ACCPACErrorHandler:
…
End Sub
When I run the macro I get the following...
Crystal Reports Error: Logon failed.
Details: ADO Error Code 0x80004005
Source: Microsoft OLE DB Provider for SQL Server
Description: Invalid authorization specification
SQL State: 28000
What am I missing??
Thanks for the help
In the report, I’ve created the following Parameter Fields
-CMPNAME
-PATH
-EXT
-DATE
I saved the report under ACCPAC\AR53A\ENG
I modified the arrpt.ini file by adding the following at the bottom of the file
'************** Testing ********************
[ARREPORT]
heading="Test Report"
crystal= ARREPORT
orientation=portrait
paper size=1
optparams=1
2=DATE STRING
Then I created the following macro
Sub MainSub()
On Error GoTo ACCPACErrorHandler
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim rptObj As AccpacCOMAPI.AccpacReport
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Set rptObj = mDBLinkCmpRW.Session.ReportSelect("ARREPORT", "", "")
rptObj.SetParam "DATE", "20060601"
rptObj.PrintDestination = PD_PREVIEW
rptObj.PrintReport
Exit Sub
ACCPACErrorHandler:
…
End Sub
When I run the macro I get the following...
Crystal Reports Error: Logon failed.
Details: ADO Error Code 0x80004005
Source: Microsoft OLE DB Provider for SQL Server
Description: Invalid authorization specification
SQL State: 28000
What am I missing??
Thanks for the help