For your first Question, it is nearly impossible.
For your second Question, there are 2 sets of job you need to do.
1. Change your registry to allow IIS user to access your printer (find it in microsoft knowledge base(Q184291), if you still have difficulty, I will try to put it here)
2. Make your code (assumed that you have installed crystal report in your web server)
*** The coding works ***
'The Following is print the result......
if session("PrintDetails") = 1 then
'*** you can use SQL statement rather than calling stored procedure
Set cmd = Server.CreateObject("ADODB
Set cmd.ActiveConnection = cn
cn.cursorLocation = adUseClient
cmd.CommandText = "nameofstoredprocedure"
cmd.CommandType = adCmdStoredProc
Set Session("oRS") = Server.CreateObject("ADODB
Set Session("oRS") = cmd.Execute
Session("error") = ""
if not Session("oRS").EOF then
%> <%
reportname="reportname.rpt
'Use Crystal Report Object to print your document
Set session("oApp") = Server.CreateObject("Cryst
path = "c:\folder\subfolder\"
If IsObject(session("oRpt")) then
set session("oRpt") = nothing
End If
Set session("oRpt")=session("o
'Clean up data of the report; useful for printing forest and clean up the previous one.
session("oRpt").DiscardSav
set Database = session("oRpt").Database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
'Read the record set into the table for printing
Table1.SetPrivateData 3, Session("oRS")
On Error Resume Next
session("oRpt").ReadRecord
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attemping to access the data source"
Response.Write " The NO & DESCRIPTION IS [" & Err.Number & ":" & Err.Description & "] <br>"
Else
If IsObject(session("oPageEng
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine
End If
'Printer being shared, you can find the following information by printer test page of the printer
Session("oRpt").SelectPrin
If Err.Number <> 0 then
response.write "oRpt SelectPrinter failed with error [" & Err.Number & ":" & Err.Description & "] <br>"
End If
Dim result
result = session("oRpt").PrintOut(F
end if
end if
If Err.number <> 0 Then
Session("error") = "Error: Invoice Cannot Be Found / You Do Not Have Premission"
if errorCode = 2 then
Session("error") = "Error: " & Err.Number & ". " & Err.Description
Else
errorCode = 1
Session("error") = "Error: Invoice Cannot Be Found / You Do Not Have Premission"
End If
end if
'****** END of Printing Function
Main Topics
Browse All Topics





by: dclark88Posted on 2002-12-12 at 09:48:52ID: 7573399
Sorry this cant be done..
there is no way to print preview a report other than using the print preview that comes with IE