PDA

View Full Version : print a report


petertran123
05-07-2003, 05:48 PM
Dear All,

I have a page showing all the record from database. Now, i want to add a button call "Print Report ". According to the code below when the checkbox has being checked and i can hit the Print Report button to print out what box has being checked on through the database. Can anyone help me with that...Thank you much


& "<TABLE BORDER=0 cellspacing=""1"" cellpadding=""5"" align=""center"">" & vbCrlf
Dim iLoop
strReturn = strReturn & vbCrlf _
& " <TR>" & vbCrlf _
& " <TH class=""header"">&nbsp;</TH>" & vbCrlf _
& " <TH class=""header"">First Name</TH>" & vbCrlf _
& " <TH class=""header"">Last Name</TH>" & vbCrlf _
& " <TH class=""header"">Primary SSN</TH>" & vbCrlf _
& " <TH class=""header"">Check Amount</TH>" & vbCrlf _
& " <TH class=""header"">Date</TH>" & vbCrlf _
& " </TR>" & vbCrlf
Dim iCount
iCount = 0
Do While Not rsData.EOF ' If the selected report contains data, include the following code

strReturn = strReturn & vbCrlf _

& "<TR class=""standard"">" & vbCrlf _
& "<TD ALIGN=""CENTER"">" & vbCrlf _
& "<INPUT TYPE=""CHECKBOX"" NAME=""checkall"" VALUE=""" & rsData("TRANS_ID") & """>" & vbCrlf _
& "</TD>" & vbCrlf _
& "<TD>" & rsData("PrimaryNameFirst") & "</TD>" & vbCrlf _
& "<TD>" & rsData("PrimaryNameLast") & "</TD>" & vbCrlf _
& "<TD>" & rsData("PrimarySSN") & "</TD>" & vbCrlf _
& "<TD>" & rsData("CheckAmt") & "</TD>" & vbCrLf _
& "<TD>" & rsData("CheckDate") & "</TD>" & vbCrlf _
& "<INPUT TYPE=HIDDEN NAME=""" & iCount & ".TRANS_ID"" VALUE=""" & rsData("TRANS_ID") & """>" & vbCrLf _
& "</TD></TR>" & vbCrLf
'Move to the next record...
rsData.MoveNext

'Increment the count variable
iCount = iCount + 1
Loop

raf
05-08-2003, 08:30 AM
Do you want to create a pdf file that wil be printed or just (automatically) print of an html page? PDF --> think you'll need a component for that. HTML --> open the page in a new windon (same code as if you would select the record an display it in a webpage) + use some javascript that prints the page (on load) and closes the window.

petertran123
05-08-2003, 04:14 PM
Thanks for your replying, yes i want to be able to generate into PDF , and when user checked on checkbox and hit print report button to print out the report. I know this sound very rough, but i do need your help or any sources that might help. I'm truly appreciate it. Thanks

raf
05-08-2003, 07:52 PM
here you go

http://www.15seconds.com/issue/990902.htm

It works like this : first build the pdf file as some sort of empty form(you need adobe for that) . Then the asp page fills in the formelements.

There are some commercial product, but most of them cost about 200 to 250 $.

It's far easier to do similar things with ASP.NET or PHP ...

petertran123
05-12-2003, 02:17 PM
Currently, i'm using Crystal Report and i want to convert over to PDF or (print to PDF). The purpose i did that because i want our clients to be able to print to their local printer without previewing it or without any of printing dialog pop up. In printing part i'll be using some Javascripts as you mention in early note. Do you have any resource that might help or any example? Please help me i need it very badly. Thanks

raf
05-12-2003, 03:01 PM
Not a cryustal reports expert, but there are some tools for that. Like

http://www.crystal-reports-web.com/merchant/details.htm

petertran123
05-13-2003, 03:20 PM
thanks Raf, i look at the link you gave me, but it seems not to work with PDF.

raf
05-13-2003, 06:32 PM
What do you mean?
Did you scroll down to look at the features? Thought this was exactly what you wanted (except for automatic printing, but i don't evn think it is possible without the user confirming in the printerdialog)