Click to See Complete Forum and Search --> : Export To Excel Then Send Out As Attachment


cba321
02-28-2005, 02:34 AM
Hi,

I need help on sending the form out as an attachment. I've done exporting the data to excel format but the problem is I want to send it out as attachment and may need to attach other files from my computer, so i will nid the mail dialogbox to pop up. Can someone pls help me? here is my code:
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT Order.MatchID, Order.EID, Order.ProductNumber, Order.ProductOption, Order.Description, Order.Quantity_Unit FROM Order, Product WHERE Product.ID=Order.MatchID", conn

Response.ContentType = "application/vnd.ms-excel"
%>
<table BORDER="1" align="center">
<tr>
<td bgcolor=#FF6600 align=center><font color=white><b>Reference ID</b></font></td>
<td bgcolor=#FF6600 align=center><font color=white><b>EID</b></font></td>
<td bgcolor=#FF6600 align=center><font color=white><b>Product Number</b></font></td>
<td bgcolor=#FF6600 align=center><font color=white><b>Product Option</b></font></td>
<td bgcolor=#FF6600 align=center><font color=white><b>Description</b></font></td>
<td bgcolor=#FF6600 align=center><font color=white><b>Quantity(Unit)</b></font></td>
</tr>

<%
' Move to the first record
rs.movefirst

' Start a loop that will end with the last record
do while not rs.eof
%>

<tr>
<td>
<%= rs("MatchID") %>
</td>

<td>
<%= rs("EID") %>
</td>

<td>
<%= rs("ProductNumber") %>
</td>

<td>
<%= rs("ProductOption") %>
</td>

<td>
<%= rs("Description") %>
</td>

<td>
<%= rs("Quantity_Unit") %>
</td>
</tr>

<%
' Move to the next record
rs.movenext
' Loop back to the do statement
loop %>

cba321
02-28-2005, 07:18 PM
Hi,

Ok, I see that nobody reply to my question maybe because u guys are confused by my question. Anyway, to make it simple, can anybody suggest how to:

1) Export data from MS Access to Excel using ASP programming
2) Send the Excel file as attachment using MS Outlook

OR

3) Pop up the mail dialogbox with the Excel file already attached.

Thanks

phpnovice
02-28-2005, 07:28 PM
The approach you're taking is basically a "can't-get-there-from-here" type of situation. Instead, you'd have to create the Excel-format file on the server (using ADO for both the database and the Excel workbook) and use server-side mail (e.g., CDONTS or CDOSYS) to send an email with the Excel file attached.

cba321
02-28-2005, 08:56 PM
but how to do this...."Excel-format file on the server (using ADO for both the database and the Excel workbook)".....how to create excel file on the server? I know that CDONT sends mail automatically without the mail dialog pop up, but user may want to attach another file on their own. so it's not possible to export and send it as attachment all at once? coz now i can export it to excel-format but user may need to save and send the mail out manually.

anyway, basically what i want to do is smthg like that but im open to any other idea of how to play around with ASP but still get the mail sent out?

thanks

phpnovice
02-28-2005, 09:39 PM
If you send the Excel file to the client, as you are now, there is no choice but for the visitor to save the file on their harddrive and perform all of the remaining email handling functions themselves. You cannot control this through the browser.

On the other hand, there is nothing stopping the visitor from uploading additional files to be attached to the email which you can send from your ASP code.