<% Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("tables.mdb") Set rsHeaders = server.CreateObject("ADODB.Recordset") rsheaders.Open "SELECT * FROM tblHeaders WHERE headerid=" & Request.QueryString("headerid"),conn,3,3 'don't forget to put ithe inc filename below dirpath="../" CurTitle="VEPT - Electricity - " & rsheaders.Fields("title") Location="Home/Electricity/data table" BigTable=true %> <%=CurTitle%> <% set rsYears = server.CreateObject("ADODB.Recordset") set rsData=server.CreateObject("ADODB.Recordset") rsYears.Open "SELECT *, InStr(1,[filter],'tblcustomers') AS filterme FROM tblYear WHERE InStr(1,[filter],'" & rsheaders.Fields("table") & "')>0 ORDER BY [YEAR] DESC",conn,3,3 rsData.Open "SELECT * FROM " & rsheaders.Fields("table") & " WHERE sector=" & rsheaders.Fields("sectorid"),conn,3,3 %>

<%=rsheaders.Fields("title")%>

<% do while not rsYears.EOF %> <% rsYears.MoveNext loop rsYears.MoveFirst %> <% do while not rsData.EOF if rsdata.Fields("isbold") then dobold1="" dobold2="" else dobold1="" dobold2="" end if %> <% do while not rsYears.EOF CurYear=rsYears.Fields("year") %> <% rsYears.MoveNext loop rsYears.MoveFirst %> <% rsData.MoveNext loop rsData.Close rsYears.Close %>
Utility by Ownership Class<%=rsYears.Fields("year")%>
<%=dobold1%><%=rsdata.Fields("desc")%><%=dobold2%><%=dobold1%><%=rsdata.Fields(curyear)%><%=dobold2%>

.csv">Get the data in CSV format

<%=rsheaders.Fields("source")%>