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

Dowload large files to Excel

Status
Not open for further replies.

MaddogC

Programmer
Dec 4, 2003
134
0
0
GB
I am trying export a large amount of data to excel from a recordset which fails presumably because of a timeout. How do I get the size of my recordset so that I can break it down using Chunks? My code thus far is

Do until RSRef.EOF
For Each F In RSREf.Fields
if F.Type = adDouble or F.Type = adInteger or F.Type = adNumeric or F.Type = adSingle then
if isnull(F.Value) then
Main = Main & ",""" & strSpace & """"
Else
Main = Main & "," & replace(F.Value,",","")
End IF
Else

if isnull(F.Value) then
Main = Main & ",""" & strSpace & """"
Else
Main = Main & ",""" & replace(F.Value,",","") & """"
End If
End if
Next
Main = Mid(Main,2) & vbCrLf
Response.ContentType = "text/plain"
Response.Write Main
Main=""
RSRef.Movenext
Loop
 
Cheers I'll have a look, yes the content type shouldn't be in the loop.

I'm exporting about 30,000 rows so the Excel limit isn't a problem
 
I've had a loot at your site. However is there anyway to download the file using a method similar to that above and without the need to save it to the server.
 
by the way its the Sheco postings you want to be looking at
 
Thanks, Finally got back to this. Worked a treat.
 
To make sure your server dosnt get filled with temp files create an .asp page with this code on

<%
On error resume next
set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile("Q:\%>

then make it an include on the default page and then ever time someone opens the database it will clear all the files out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top