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!

printing without viewing

Status
Not open for further replies.

jacktripper

Programmer
Dec 5, 2001
124
US

Below is some code that I originally used to view a report in the browser with the Active X component. That worked fine.

Now I want to send it straight to the printer without viewing it. To do this, I just added the report.PrintOut function on the bottom (past all the error checking junk). However, nothing prints out.

What am I missing here? I don't get any error messages either....

Any help would be lovely.

-------------------------
<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>

<%

reportname = Request(&quot;reportName&quot;)

MasterID = Request(&quot;MasterID&quot;)

%>

<%

If Not IsObject (session(&quot;oApp&quot;)) Then
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;CrystalRuntime.Application.9&quot;)
End If

Path = Request.ServerVariables(&quot;PATH_TRANSLATED&quot;)
While (Right(Path, 1) <> &quot;\&quot; And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend

If IsObject(session(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

On error resume next

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

If Err.Number <> 0 Then
Response.Write &quot;Error Occurred creating Report Object: &quot; & Err.Description
Set Session(&quot;oRpt&quot;) = nothing
Set Session(&quot;oApp&quot;) = nothing
Session.Abandon
Response.End
End If

session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = True
session(&quot;oRpt&quot;).EnableParameterPrompting = True
session(&quot;oRpt&quot;).DiscardSavedData

Session(&quot;oRpt&quot;).ParameterFields.GetItemByName(&quot;MyMasterID&quot;).AddCurrentValue(CStr(Request(&quot;MasterID&quot;)))

On Error Resume Next

session(&quot;oRpt&quot;).ReadRecords

If Err.Number <> 0 Then
Response.Write &quot;Error Occurred Reading Records: &quot; & Err.Description
Set Session(&quot;oRpt&quot;) = nothing
Set Session(&quot;oApp&quot;) = nothing
Session.Abandon
Response.End
Else
If IsObject(session(&quot;oPageEngine&quot;)) Then
set session(&quot;oPageEngine&quot;) = nothing
End If
set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If

'Sub PrintOut([promptUser], [numberOfCopy], [collated], [startPageN], [stopPageN])
'Member of CRAXDRT.Report
'Prints the report to printer.

Session(&quot;oRpt&quot;).printout false

%>
<html>
<head>
<title>Window open only for some time</title>
<script>
function closeCall()
{
window.close();
}
function autoCall()
{
setTimeout('closeCall()','1');
}
</script>
<body onLoad=&quot;autoCall();&quot;>
<p><B><H3>Your reports are now printing. Dance a jig. <BR> Click &quot;Yes&quot; to close this window and return to iDeal</p>
</body>
</html>




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top