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 -
RS1.Open SQL, cnn, 0, 1
-
-
if request.Form("id") = "" then
-
%>
-
<table class="cobtbl" width="100%" border="0" cellspacing="1" cellpadding="3">
-
<tr>
-
-
<td class="cobhl" align="center"><strong>Full Name</strong></td>
-
<td class="cobhl" align="center"><strong>Attendee Type</strong></td>
-
<td class="cobhl" align="center"><strong>Company</strong></td>
-
<td class="cobhl" align="center"><strong>Item</strong></td>
-
<td class="cobhl" align="center"><strong>Print</strong></td>
-
<%
-
do while not rs1.eof %>
-
<tr>
-
<td align="center"><%=rs1("FullName")%></td>
-
<td align="center"><%=rs1("AttendeeType")%></td>
-
<td align="center"><%=rs1("CompanyName")%></td>
-
<td align="center"><%=rs1("Item1")%></td>
-
<td align="center"><input type="button" title="Print" value="Print" onclick="printrec('<%=rs1("ConfirmationNo")%>','<%=rs1("FullName")%>','<%=rs1("CompanyName")%>','<%=rs1("Item1")%>')" /></td>
-
-
</tr>
-
-
<%
-
rs1.movenext
-
loop
-
-
rs1.close: set rs1=nothing
-
%>
-
-
<td align="center"><input type="button" title="Print" value="Print All Tickets" onclick="printrec()"
4 1777
When developing a website there are 2 sets of code that you need to consider: - Client-Side code: code that is run in the web browser
- 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()": -
<input type="button"
-
title="Print"
-
value="Print All Tickets"
-
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: -
<script type="text/javascript">
-
function printrec(){
-
window.print();
-
}
-
</script>
-
<input type="button"
-
title="Print"
-
value="Print All Tickets"
-
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).
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: -
<html>
-
<head>
-
<script language="javascript" type="text/javascript">
-
function printrec(id,fn,comp,it){
-
document.forms.psearchform.id.value = id;
-
document.forms.psearchform.fn.value = fn;
-
document.forms.psearchform.comp.value = comp;
-
document.forms.psearchform.it.value = it;
-
document.forms.psearchform.act.value = "printrec";
-
document.forms.psearchform.submit();
-
-
}
-
</script>
-
</head>
-
-
<form method="post" action="printbadge.asp" name="psearchform">
-
<input type="hidden" name="act" value="" />
-
<input type="hidden" name="id" value="" />
-
<input type="hidden" name="fn" value="" />
-
<input type="hidden" name="comp" value="" />
-
<input type="hidden" name="it" value="" />
-
</form>
-
-
<%
-
-
Response.Buffer = True
-
isadmincsv=TRUE
-
-
Function iif(expression, truePart, falsePart)
-
If expression Then
-
iif = truePart
-
Else
-
iif = falsePart
-
End If
-
End Function
-
Dim sDSN
-
sDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files (x86)\EventPro Software\Attendee Online\App_Data\webdata.mdb;"
-
set RS1 = Server.CreateObject("ADODB.RECORDSET")
-
Set cnn=Server.CreateObject("ADODB.Connection")
-
cnn.open sDSN
-
-
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") & "'"
-
-
-
-
-
-
RS1.Open SQL, cnn, 0, 1
-
-
if request.Form("id") = "" then
-
%>
-
<table class="cobtbl" width="100%" border="0" cellspacing="1" cellpadding="3">
-
<tr>
-
<td class="cobhl" align="center"><strong>Confirmation No</strong></td>
-
<td class="cobhl" align="center"><strong>Full Name</strong></td>
-
<td class="cobhl" align="center"><strong>Company</strong></td>
-
<td class="cobhl" align="center"><strong>Item</strong></td>
-
<td class="cobhl" align="center"><strong>Print</strong></td>
-
<%
-
do while not rs1.eof %>
-
<tr>
-
<td align="center"><%=rs1("ConfirmationNo")%></td>
-
<td align="center"><%=rs1("FullName")%></td>
-
<td align="center"><%=rs1("CompanyName")%></td>
-
<td align="center"><%=rs1("Item1")%></td>
-
<td align="center"><input type="button" title="Print" value="Print" onclick="printrec('<%=rs1("ConfirmationNo")%>','<%=rs1("FullName")%>','<%=rs1("CompanyName")%>','<%=rs1("Item1")%>')" /></td>
-
</tr>
-
<%
-
rs1.movenext
-
loop
-
-
set rs1=nothing
-
%>
-
</table>
-
<input type="button" title="Print" value="Print All" onclick="printrec()" />
-
<%else
-
-
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") & "'")
-
-
Dim imgPath
-
if request.Form("it") <> "" then
-
if Instr(request.Form("it"), "Pass") > 0 then
-
imgPath="ONEDAYPASS"
-
elseif Instr(request.Form("it"), "Course") > 0 then
-
imgPath="BROWN"
-
elseif Instr(request.Form("it"), "Young") > 0 then
-
imgPath="AYPC1"
-
elseif Instr(request.Form("it"), "Adhoc") > 0 then
-
imgPath="GREEN"
-
elseif Instr(request.Form("it"), "Booth") > 0 then
-
imgPath="BOOTH_FAMILY"
-
elseif Instr(request.Form("it"), "Complimentary") > 0 then
-
imgPath="GREEN"
-
-
elseif Instr(request.Form("it"), "Family") > 0 then
-
imgPath="RED"
-
else
-
imgPath="NIACE14"
-
end if
-
-
else
-
imgPath="NIACE14"
-
end if
-
-
%>
-
-
<table background="<%=imgPath%>.jpg" style="background-repeat:no-repeat" height="271px" width="362px" >
-
<tr><td align="center" height="50px" style="font-size:meduim"> </td> </tr>
-
<tr><td align="center" height="30px" style="font-size:28px"><b><%=request.Form("it")%></b> </td> </tr>
-
<tr><td align="center" valign="top" height="28x" style="font-size:larger"><%=request.Form("fn")%> </td> </tr>
-
<tr><td align="center" valign="top" height="27px" style="font-size:larger"><%=request.Form("comp")%> </td> </tr>
-
<tr><td align="center" height="20px" style="font-size:larger"> </td> </tr>
-
<tr><td align="center" style="font-size:18px;color:#000000"><%=request.Form("")%> </td> </tr>
-
-
-
</table>
-
<%end if%>
-
-
-
</html>
So, did adding the function fix the error or are you still experiencing the same error??
no it did not.
what i want to achieve is to add a print all.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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
| |