Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create macro to display Crystal Report

Status
Not open for further replies.

kenaruj

Programmer
Jun 2, 2006
16
US
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
 
The above report pulls data from a single custom table 'ARDEV' that has been created within the ACCPAC DAT database (although future versions of the report will need to use data from 'ARCUS').
 
Sorry, you can't use non-Accpac tables with the Accpac report object. You'll have to write your own wrapper with the regular Crystal OCX.

Jay Converse
IT Director
Systemlink, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top