Hi, I am very new to ASP and am trying to export an entire table from access to an excel file through the browser. I simply want the user to click on a link and then have excel launch with the queried table. So far I have written a little code that calls a saved query from within Access, but it doesn't show up when excel launches after I click the link. Below is my code, and any help would be appreciated:

<%pageTitle="Export All Data to Excel"%>
<!--#include file="includes/top.asp"-->

<%If request("print")="Yes" Then
Response.ContentType = "application/vnd.ms-excel"

Dim objConn
Dim objRs
'Dim objCmd  -- not used

Set objConn = Server.CreateObject("ADODB.Connection")
Set objRs =Server.CreateObject("ADODB.recordset")

Dim strConnect
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\Cpcusskwebp2\opsnatplan$\files\CMFlashReport\database\flashreport.mdb"
objConn.open strConnect

strQuery = "site_information_qry"
objRS.Open strQuery, objConn, 0, 4

'objRs.open "SELECT * FROM site_information"   -- not currently used
%>

<%End If%>

Hi, I am new here too - but to solve your problem, you simply export the data to a table (normal html)

For example - carrying on from your code

response.write "<table>"

do while not objRS.eof
						htmlGuts = htmlGuts & "	<tr>" & vbNewline
						htmlGuts = htmlGuts & "		<td width=""1%"" ><font size=""1"">" & objRS("FieldName") & "</font></td></tr>" & vbNewline

loop
Response.write htmlGuts & "</table>"

Hope this answers your query.

Regards

Darrin

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.