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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editable reports

Status
Not open for further replies.

HardHat

IS-IT--Management
Aug 7, 2003
14
US
HI,

I have the code listed below that creates a report showing all relevant records within a DB. I now have an issue where the user wants to be able to edit the contents of one of the fields/columns (mattnotes) - the changes are not be written back to the db, just to appear on the page ready for printing.

Any ideas if this is possible ?

Code:
<%@LANGUAGE = VBScript %>
<% Option Explicit %>
<!-- #INCLUDE FILE="../Scripts/GetDatabase.asp"-->
<%
Dim RS, strSQL


'Open Database - DBConnect sub procedure in GetDatabase.asp
Call DBConnect("adtracking.mdb")

Set RS=Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT * FROM bookingform WHERE issuedatetxt = '"& Request ("issuedate")&"' and joburgwam <>'' or issuedatetxt = '"& Request ("issuedate")&"' and joburgcd <>'' or issuedatetxt = '"& Request ("issuedate")&"' and joburgother<>'' ORDER BY adcode ASC;"
RS.Open strSQL, DB

Dim currentColor, colorType1, colorType2
colorType1 = "#BFCFFF"
colorType2 = "#9FBEFE"
currentColor = colorType1
%>
<html>
<head>

	<title>AOL Time Warner</title>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#808080" alink="#FF0000" leftmargin=0 topmargin=0 marginheight="0" marginwidth="0">

<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
	<td bgcolor="#768ABE">
		<table width="647" border="0" cellspacing="1" cellpadding="3" align="left" height="60">
				
		<tr>
			<td bgcolor="#FFFFFF" width="621" height="32" colspan="17" align="center"><b><font face="Arial" size="2">Material 
            Transmission Information - Joburg Plant</font></b></td>

	
		</tr>
		
		<tr>
			<td bgcolor="#FFFFFF" width="40" height="32"><font face="Arial" size="2">Booking Ref</font></td>
			<td bgcolor="#FFFFFF" width="40"><font face="Arial" size="2">Revision Number</font></td>
			<td bgcolor="#FFFFFF" width="40" height="32"><font face="Arial" size="2">Ad Type</font></td>
			<td bgcolor="#FFFFFF" width="40" height="32"><font face="Arial" size="2">Advertiser</font></td>						
			<td bgcolor="#FFFFFF" width="40" height="32"><font face="Arial" size="2">Edition</font></td>
			<td bgcolor="#FFFFFF" width="40" height="32"><font face="Arial" size="2">Issue Date</font></td>
			<td bgcolor="#FFFFFF" width="27" height="32"><font face="Arial" size="2">Unit Size</font></td>
			<td bgcolor="#FFFFFF" width="27" height="32"><font face="Arial" size="2">Unit Info</font></td>
			<td bgcolor="#FFFFFF" width="60" height="32"><font face="Arial" size="2">Colour</font></td>
			<td bgcolor="#FFFFFF" width="49" height="32"><font face="Arial" size="2">Bleed</font></td>
			<td bgcolor="#FFFFFF" width="49" height="32"><font face="Arial" size="2">Bleed Details</font></td>
			<td bgcolor="#FFFFFF" width="49" height="32"><font face="Arial" size="2">Caption</font></td>
			<td bgcolor="#FFFFFF" width="49" height="32"><font face="Arial" size="2">Material Type</font></td>				
			<td bgcolor="#FFFFFF" width="49" height="32"><font face="Arial" size="2">Material Notes</font></td>
			<td bgcolor="#FFFFFF" width="49" height="32"><font face="Arial" size="2">Repeat Date</font></td>
			<td bgcolor="#FFFFFF" width="49"><font face="Arial" size="2">Dup Request</font></td>
			<td bgcolor="#FFFFFF" height="32"><font face="Arial" size="2">WamNet</font></td>
			<td bgcolor="#FFFFFF" height="32"><font face="Arial" size="2">CD</font></td>
			<td bgcolor="#FFFFFF" height="32"><font face="Arial" size="2">Other</font></td>

	
		</tr>
		
		<%Do while Not RS.EOF
		Response.write "<tr>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2><a href='edrevbookingform.asp?unique="& RS("unique") &"'>"& RS("unique") &"</a></td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("revisionno") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("adtype") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("advertiser") &"</td>"		
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("edition") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("Issue Date") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("adsize") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("unitinfo") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("colour") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("bleed") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("bleeddetails") &"</td>"
		
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("caption") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("mattype") &"</td>"		
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("matnotes") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("repeatdt") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("dupreq") &"</td>"		
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("joburgwam")&"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("joburgcd") &"</td>"
		Response.write "	<td bgcolor="& currentColor &"><font face=Arial size=2>"& RS("joburgother") &"</td>"

		Response.write "</tr>"
		if(currentColor = colorType1)then
			currentColor = colorType2
		else
			currentColor = colorType1
		end if
		RS.MoveNext
		Loop
		%>
		</table>
	</td>
</tr>
  <TR>
<td colspan="2" align="middle" bgcolor="#ffffff" height="30">

      &nbsp;<p>
      <input type="button" name="doit" id="doit0" value="PRINT" onclick="print()"></p>
      <p>

      <br>
				<input type="button" name="doit" id="doit" value="Ad Tracking Home" onclick="document.location = 'default.asp';"> 
      
			</td></TR>
</table>
<br><br><br>
</body>
</html>
<%
RS.close
%>

Any help would be appreciated.
 
I'm going to make a stab which certainly has it's problems, but may give you some ideas...

Instead of just writing the data to a table, place that table within a form and write the data to a form textarea field in the table structure. I'm showing a sample column below.

Code:
response.write "<td bgcolor="& currentColor &"><font face=Arial size=2><a href='edrevbookingform.asp?unique='" & RS("unique") & "'><textarea rows='4' name='S1' cols='5' >" & RS("unique") & "</textarea></a></td>"

The scrolling text box is the only way to get more than on line in a form field. Choosing its cols & row sizes might be tricky. But then, if you wanted to get fancy you could determine the length of the data and establish the column and row sizes from there. That still doesn't settle the issue of how much the user wants to type in. If he types in too much it will scroll and only the first portion will be visible in a printout. But there's hope. Submit the form by posting to another page. The form fields could be placed into table for printing and all the data would be visible.

I know, it's a stretch, but it's about the only way I could think of.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top