473,320 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Recordset Single print

3
Hi, Please I want a PrintAll button that can print all tickets onclick. The other codes work perfectly except the last line. It tells me undefined. Actually it is registration tickets I want to print. Pls see attached image.

Thanks
Expand|Select|Wrap|Line Numbers
  1.     RS1.Open SQL, cnn, 0, 1
  2.  
  3.     if request.Form("id") = "" then
  4. %>
  5.     <table class="cobtbl" width="100%" border="0" cellspacing="1" cellpadding="3">
  6.     <tr>
  7.  
  8.         <td class="cobhl" align="center"><strong>Full Name</strong></td>
  9.                 <td class="cobhl" align="center"><strong>Attendee Type</strong></td>
  10.         <td class="cobhl" align="center"><strong>Company</strong></td>
  11.         <td class="cobhl" align="center"><strong>Item</strong></td>
  12.         <td class="cobhl" align="center"><strong>Print</strong></td>
  13. <%
  14.     do while not rs1.eof %>
  15.         <tr>
  16.             <td align="center"><%=rs1("FullName")%></td>
  17.             <td align="center"><%=rs1("AttendeeType")%></td>
  18.             <td align="center"><%=rs1("CompanyName")%></td>
  19.             <td align="center"><%=rs1("Item1")%></td>
  20.                    <td align="center"><input type="button"  title="Print"  value="Print" onclick="printrec('<%=rs1("ConfirmationNo")%>','<%=rs1("FullName")%>','<%=rs1("CompanyName")%>','<%=rs1("Item1")%>')" /></td>
  21.  
  22.                      </tr>
  23.  
  24. <%
  25.         rs1.movenext
  26.     loop
  27.  
  28.     rs1.close: set rs1=nothing
  29. %>
  30.  
  31. <td align="center"><input type="button"  title="Print"  value="Print All Tickets" onclick="printrec()"
Attached Images
File Type: jpg recordset.jpg (18.0 KB, 140 views)
Dec 3 '13 #1
4 1777
Frinavale
9,735 Expert Mod 8TB
When developing a website there are 2 sets of code that you need to consider:
  1. Client-Side code: code that is run in the web browser
  2. Server-Side code: code that is run on the web server

You have HTML markup for a button in the code that you posted. Once rendered by the browser, this button exists in the browser and has client-side events that are associated with it. One of these client-side events is the "onclick" event. You provide it with a JavaScript method to call when this event is fired (remember, JavaScript runs in the browser and so it is "client-side" code)

So, the following will indicate that when the button is clicked it should call a JavaScript function named "printrec()":
Expand|Select|Wrap|Line Numbers
  1. <input type="button"  
  2.   title="Print"  
  3.   value="Print All Tickets" 
  4.   onclick="printrec()"/>
If you do not have a JavaScript function named "printrec()" then you will get a client-side error along the lines of "Object not defined".

So, to fix the problem you should define a function called "printrec()" which calls the JavaScript window.print() method to open a print dialogue and allow the user to specify where to print to.

Like this:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function printrec(){
  3.   window.print();
  4. }
  5. </script> 
  6. <input type="button"  
  7.   title="Print"  
  8.   value="Print All Tickets" 
  9.   onclick="printrec()"/>
If you wanted this to be printed out at the server, than you would not handle the client-side click event as you are. Instead, you would have to submit to server-code that would do the printing for you.



-Frinny


(PS: Please note that the HTML for your button that you posted is not valid because you are missing the close tag for it...but you are also missing the close tag for the td element as well so I'll assume it's just a copy/paste mistake).
Dec 9 '13 #2
spenc
3
Hi Frinny,
Thanks for your response. the tag was a copy and paste error.
I have the function printrec() .
let me paste the entire code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="javascript" type="text/javascript">
  4. function printrec(id,fn,comp,it){
  5.     document.forms.psearchform.id.value = id;
  6.     document.forms.psearchform.fn.value = fn;
  7.     document.forms.psearchform.comp.value = comp;
  8.     document.forms.psearchform.it.value = it;
  9.     document.forms.psearchform.act.value = "printrec";
  10.     document.forms.psearchform.submit();
  11.  
  12. }
  13. </script>
  14. </head> 
  15.  
  16. <form method="post" action="printbadge.asp" name="psearchform">
  17.             <input type="hidden" name="act" value="" />
  18.             <input type="hidden" name="id" value="" />
  19.             <input type="hidden" name="fn" value="" />
  20.             <input type="hidden" name="comp" value="" />
  21.             <input type="hidden" name="it" value="" />
  22. </form>
  23.  
  24. <%
  25.  
  26. Response.Buffer = True
  27. isadmincsv=TRUE
  28.  
  29. Function iif(expression, truePart, falsePart)
  30.     If expression Then
  31.         iif = truePart
  32.     Else
  33.         iif = falsePart
  34.     End If
  35. End Function
  36. Dim sDSN
  37. sDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files (x86)\EventPro Software\Attendee Online\App_Data\webdata.mdb;" 
  38. set RS1 = Server.CreateObject("ADODB.RECORDSET")
  39. Set cnn=Server.CreateObject("ADODB.Connection")
  40. cnn.open sDSN
  41.  
  42.     SQL = "SELECT EventAttendee.UniqueID, EventAttendee.BookNo, EventAttendee.AttendeeType, EventAttendee.FullName, EventAttendee.NameBadge, EventAttendee.CompanyName, EventAttendee.ConfirmationNo, EventRegGroup.RegGroup, EventReg.Item, iif(EventReg.Item is null,EventRegGroup.RegGroup, EventReg.Item) as Item1 FROM (EventRegGroup INNER JOIN (((EventAttendee INNER JOIN EventAttendeeReg ON (EventAttendee.UniqueID = EventAttendeeReg.EventAttendeeID) AND (EventAttendee.BookNo = EventAttendeeReg.BookNo)) INNER JOIN EventAttendeeRegGroup ON (EventAttendee.BookNo = EventAttendeeRegGroup.BookNo) AND (EventAttendeeReg.UniqueID = EventAttendeeRegGroup.EventAttendeeRegID) AND (EventAttendee.UniqueID = EventAttendeeRegGroup.EventAttendeeID)) LEFT JOIN EventAttendeeRegGroupDetail ON EventAttendeeRegGroup.UniqueID = EventAttendeeRegGroupDetail.EventAttendeeRegGroupID) ON EventRegGroup.UniqueID = EventAttendeeRegGroup.EventRegGroupID) LEFT JOIN EventReg ON EventAttendeeRegGroupDetail.EventRegID = EventReg.UniqueID WHERE (EventAttendee.StatusID = {guid {6B7B1795-8717-4E7B-B504-A4EA6BCD4D08}}) AND EventAttendee.ConfirmationNo ='" & request.QueryString("id") & "'"
  43.  
  44.  
  45.  
  46.  
  47.  
  48.     RS1.Open SQL, cnn, 0, 1
  49.  
  50.     if request.Form("id") = "" then
  51. %>
  52.     <table class="cobtbl" width="100%" border="0" cellspacing="1" cellpadding="3">
  53.     <tr>
  54.         <td class="cobhl" align="center"><strong>Confirmation No</strong></td>
  55.         <td class="cobhl" align="center"><strong>Full Name</strong></td>
  56.         <td class="cobhl" align="center"><strong>Company</strong></td>
  57.         <td class="cobhl" align="center"><strong>Item</strong></td>
  58.         <td class="cobhl" align="center"><strong>Print</strong></td>
  59. <%
  60.     do while not rs1.eof %>
  61.         <tr>
  62.             <td align="center"><%=rs1("ConfirmationNo")%></td>
  63.             <td align="center"><%=rs1("FullName")%></td>
  64.             <td align="center"><%=rs1("CompanyName")%></td>
  65.             <td align="center"><%=rs1("Item1")%></td>
  66.             <td align="center"><input type="button"  title="Print"  value="Print" onclick="printrec('<%=rs1("ConfirmationNo")%>','<%=rs1("FullName")%>','<%=rs1("CompanyName")%>','<%=rs1("Item1")%>')" /></td>
  67.     </tr>
  68. <%
  69.         rs1.movenext
  70.     loop
  71.  
  72.     set rs1=nothing
  73. %>
  74. </table>
  75. <input type="button"  title="Print"  value="Print All" onclick="printrec()" /> 
  76. <%else
  77.  
  78. cnn.Execute("UPDATE EventAttendee SET EventAttendee.AccomQuantity = 1 WHERE (EventAttendee.StatusID = {guid {6B7B1795-8717-4E7B-B504-A4EA6BCD4D08}}) AND (EventAttendee.AccomQuantity = 0) AND EventAttendee.ConfirmationNo ='" & request.Form("id") & "'")
  79.  
  80. Dim imgPath
  81. if request.Form("it") <> "" then
  82. if Instr(request.Form("it"), "Pass") > 0 then
  83.     imgPath="ONEDAYPASS"
  84. elseif Instr(request.Form("it"), "Course")  > 0 then
  85.     imgPath="BROWN"
  86. elseif Instr(request.Form("it"), "Young") > 0 then
  87.     imgPath="AYPC1"
  88. elseif Instr(request.Form("it"), "Adhoc") > 0 then
  89.     imgPath="GREEN"
  90. elseif Instr(request.Form("it"), "Booth") > 0 then
  91.     imgPath="BOOTH_FAMILY"
  92. elseif Instr(request.Form("it"), "Complimentary") > 0 then
  93.     imgPath="GREEN"
  94.  
  95. elseif Instr(request.Form("it"), "Family") > 0 then
  96.     imgPath="RED"
  97. else
  98.     imgPath="NIACE14"
  99. end if
  100.  
  101. else
  102.     imgPath="NIACE14"
  103. end if
  104.  
  105. %>
  106.  
  107. <table  background="<%=imgPath%>.jpg" style="background-repeat:no-repeat" height="271px" width="362px" >
  108. <tr><td align="center" height="50px" style="font-size:meduim">&nbsp; </td> </tr>
  109. <tr><td align="center" height="30px" style="font-size:28px"><b><%=request.Form("it")%></b> </td> </tr>
  110. <tr><td align="center" valign="top" height="28x" style="font-size:larger"><%=request.Form("fn")%> </td> </tr>
  111. <tr><td align="center" valign="top" height="27px" style="font-size:larger"><%=request.Form("comp")%> </td> </tr>
  112. <tr><td align="center" height="20px" style="font-size:larger">&nbsp; </td> </tr>
  113. <tr><td align="center" style="font-size:18px;color:#000000"><%=request.Form("")%> </td> </tr>
  114.  
  115.  
  116. </table>
  117. <%end if%>
  118.  
  119.  
  120. </html>
Dec 18 '13 #3
Frinavale
9,735 Expert Mod 8TB
So, did adding the function fix the error or are you still experiencing the same error??
Dec 18 '13 #4
spenc
3
no it did not.
what i want to achieve is to add a print all.
Dec 19 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mmccaws | last post by:
Thanks ahead for your help I'm trying to learn what I can do with echo and print statements. I figured out the echo statement and below is the simple version using print. I've tried two dozen...
4
by: Kim Chee | last post by:
I'm needing to get X number of files (.txt,.doc,.xls,.tiff,.pdf) into a single Print Job. The idea here is that a user searches for criteria in a system and then builds a batch of documents that...
16
by: John Baker | last post by:
HI; I feel like a fool..I put CUTE FTP in my last request for help --it should have been CUTE PDF! I have FTP on my mind because I have been working on a web based application, and somehow my...
9
by: trint | last post by:
Instead of just sending one document at a time, I need to send multiple documents as a print job because our laserprinter will only stack and staple one printjob it receives at a time. I need to...
2
by: Balamurali C | last post by:
Hi All I'm having one problem, since im debuging this last one week I'm not able to do. Problem: In my webage I have two Frames(top & bottom) in the top frame I'm displaying some...
0
by: beebelbrox | last post by:
Hi, I am new VB programming in Access and I am requesting help with the following code. This code is attached to a form that will display a specific recordset based in information passed to the...
0
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
11
by: Monroeski | last post by:
I'm trying to populate a recordset with a query I have stored in Access 07. I basically copied the lines from the help file on how to do this but substituted my own info - Dim dbsCurrent As...
5
by: Sandra Walsh | last post by:
Hello All - I have a main form called f_MainTripForm_Admin with a split view. The main form has fields relating to a trip. The main form has 2 sub forms. The subforms have fields related to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.