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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal reports and ASP - getting desperate!

Status
Not open for further replies.

JanS

Technical User
Feb 21, 2001
77
AU
Hi,

I am trying to create an asp page that will open a crystal report. I think Im missing something because nothing I do works. Amongst other things, I have tried the following:

Set Application = server.CreateObject "CrystalRuntime.Application")
Set Report = Application.OpenReport("sample.rpt")

only to continually get 'file not found' errors no matter how I specify the file location.

Can someone please give me an example of code to generate the report - all these entries pointing to the Cyrstal Decisions website dont help me at all!! Im using Crystal 8.5.

Hope you can help
 
Hi,
Yes I can help.
Give me your mail and i send a example

Norbert Bausch
LabExpert GmbH
 
You need to specify the absolute path to the report -- I keep a directory called rptfiles below the directory the asp page is in and I use this:

' Gets the path the current asp page is
Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> &quot;\&quot; And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & &quot;rptfiles/&quot; & reportname, 1)

So if my asp page was in c:\inetpub\It would look in the c:\inetpub\ directory for the file that I passed in (called report).
 
Thanks for your response CFDude!

I am having trouble with the following line from your example:

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & &quot;rptfiles/&quot; & reportname, 1)

The following error is produced:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[undefined]'

When I loook at the methods avaiable to the session object, OpenReport is not one of them.

Am I still missing something?!?

Thanks
jan
 
Jan,
Sorry, I have my report object in session scope -- I believe you are sticking yours in application scope.

Set report = application(&quot;oApp&quot;).OpenReport(path & &quot;rptfiles/&quot; & reportname, 1)

Just as an aside -- I have had problems with setting the report in application scope. I have multiple reports, all with their own application space, but if the reports were requested at the same time, Crystal would get &quot;confused&quot; and all my application scoped report objects would get overwritten by the last requested report.

HTH,
Tim P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top