[AccessD] Web based Project

Martin Reid mwp.reid at qub.ac.uk
Tue Oct 28 04:45:21 CST 2003


David

Have a look at this. Create a simple chart using ASP and HTML. Of the web.
Creates a simple bar chart. So it is possible. More complex examples are
available using .NET and there are lots of third party controls etc
available.

For the reports have a look at this

http://www.ssw.com.au/ssw/AccessReporterForIIS/

I am not unbaised re this companies software as they provide me with free
licences for some of thier products.


-------------------------------------------------------
Chart script.
-------------------------------------------------------

<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>

<!--#include virtual="/adovbs.inc"-->

<%
'How many pixels high we want our bar graph
Const graphHeight = 300
Const graphWidth = 450
Const barImage = "bluebar.gif"


sub BarChart(data, labels, title, axislabel)
	'Print heading
	Response.Write("<TABLE CELLSPACING=0 CELLPADDING=1 BORDER=0 WIDTH=" &
graphWidth & ">" & chr(13))
	Response.Write("<TR><TH COLSPAN=" & UBound(data) - LBound(data) + 2 & ">")
	Response.Write("<FONT SIZE=+2>" & title & "</FONT></TH></TR>" & chr(13))
	Response.Write("<TR><TD VALIGN=TOP ALIGN=RIGHT>" & chr(13))

	'Find the highest value
	Dim hi
	hi = data(LBound(data))

	Dim i
	for i = LBound(data) to UBound(data) - 1
		if data(i) > hi then hi = data(i)
	next

	'Print out the highest value at the top of the chart
	Response.Write(hi & "</TD>")

	Dim widthpercent
	widthpercent = CInt((1 / (UBound(data) - LBound(data) + 1)) * 100)

	For i = LBound(data) to UBound(data) - 1
		Response.Write(" <TD VALIGN=BOTTOM ROWSPAN=2 WIDTH=" & widthpercent & "%
>" & chr(13))
		Response.Write("   <IMG SRC=""" & barImage & """ WIDTH=100% HEIGHT=" &
CInt(data(i)/hi * graphHeight) & ">" & chr(13))
		Response.Write(" </TD>" & chr(13))
	Next

	Response.Write("</TR>")
	Response.Write("<TR><TD VALIGN=BOTTOM ALIGN=RIGHT>0</TD></TR>")

	'Write footer
	Response.Write("<TR><TD ALIGN=RIGHT VALIGN=BOTTOM>" & axislabel & "</TD>" &
chr(13))
	for i = LBound(labels) to UBound(labels) - 1
		Response.Write("<TD VALIGN=BOTTOM ALIGN=CENTER>" & labels(i) & "</TD>" &
chr(13))
	next
	Response.Write("</TR>" & chr(13))
	Response.Write("</TABLE>")
end sub


'Open connection to database
Dim objConnection
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Open "DSN=Products"

Dim strSQL
strSQL = "SELECT Name,UnitsSold FROM Products"

Dim rsProducts
Set rsProducts = Server.CreateObject("ADODB.Recordset")
rsProducts.Open strSQL, objConnection, adOpenStatic


Dim numRecords
numRecords = rsProducts.RecordCount

Dim unitsSoldArray(), labelArray()
Redim unitsSoldArray(numRecords)
Redim labelArray(numRecords)

Dim i
for i = 0 to numRecords-1
	unitsSoldArray(i) = rsProducts("UnitsSold")
	labelArray(i) = rsProducts("Name")
	rsProducts.MoveNext
next

%>

<HTML>
<BODY>
<CENTER>
<% BarChart unitsSoldArray,labelArray,"Units Sold","Product" %>
</CENTER>
</BODY>
</HTML>

<%
	rsProducts.Close
	Set rsProducts = Nothing

	objConnection.Close
	Set objConnection = Nothing
%>


----- Original Message ----- 
From: "David Emerson" <davide at dalyn.co.nz>
To: "Drew Wutka" <DWUTKA at marlow.com>; <accessd at databaseadvisors.com>
Sent: Monday, October 27, 2003 7:00 PM
Subject: Re: [AccessD] Web based Project


> Thanks Drew,  I might need to take a different approach to solve the
> problem.  If I could make the updating easier for the users this would go
a
> long way.  Currently they need to go to a web site, click on a file and
> save it to their local drive, then click on a shortcut to install the
update.
>
> Can anyone give me pointers/HTML code for automating this into one step -
> they just click on the web site link and the file is downloaded to the
> local drive (always to the same location on every ones machine), then an
> installation file is started which handles the updating.
>
> Regards
>
> David Emerson
> DALYN Software Ltd
> 25b Cunliffe St, Johnsonville
> Wellington, New Zealand
> Ph/Fax (877) 456-1205
>
> At 27/10/2003, you wrote:
> >Okay David, I took at look at that database, finally, sorry, had a long
> >week.  The data entry portion would be a snap to convert to ASP pages.
Rough
> >estimate of 6 hours.  The reports are DEFINITELY going to be a problem
> >though.  Some look pretty simple, and those could be converted to
HTML/ASP.
> >However, I saw one with a graph.  Oh, those are show stoppers when it
comes
> >to HTML, because just plain HTML doesn't play well with graphs.  Now, you
> >could still create those reports in access, and possible use scripting to
> >force print them.  There are two possibilities there.  One, messing with
> >printers/printing with client side scripting on the web is a pain.  There
> >are ActiveX controls out there that make life a lot easier, but they cost
> >money...not sure how much, probably at least one or two hundred.  Another
> >possibility would be to create a VB FE, that runs on the clients
machines.
> >It's a snap to make a browser in VB, so it could just interact with the
> >webpages, just like IE would.  But then when it came time for the
reports,
> >you run them from the server, VB 'downloads' them, and VB can then
display
> >or print them.  Just a thought....and a wild one at that, because I've
never
> >done that, but 95% of what I do in VB I've never done before! <grin>
> >
> >Drew
> >
> >-----Original Message-----
> >From: David Emerson [mailto:davide at dalyn.co.nz]
> >Sent: Tuesday, October 21, 2003 2:01 PM
> >To: Drew Wutka
> >Subject: Web based Project (Dalyn Software)
> >
> >
> >Drew,
> >
> >Thanks for your time today.
> >
> >Here is the file.  If you unzip it to a folder called C:\BWS then the FE
> >will link to the BE.
> >
> >Call me if you have any questions (below is a free phone number to NZ).
> >
> >
> >Regards
> >
> >David Emerson
> >DALYN Software Ltd
> >25b Cunliffe St, Johnsonville
> >Wellington, New Zealand
> >Ph/Fax (877) 456-1205
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list