Pasting Database Results into Excel from FP2000

B

bobs

I have a Database Results query that can produce results with over 1500 records. This is too many records to "practically" cut and paste into Excel. Is there a way in which I can have the results export to a file? Alternatively, is there a way in which I could import the results into an Excel object which would make cutting and pasting easier. Or...is there some other way to be able to get the results into Excel for the user? Thanks! Bob
 
T

Thomas A. Rowe

Is this something that you want to provide to users or is this something just for your use locally?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================


bobs said:
I have a Database Results query that can produce results with over 1500 records. This is too many
records to "practically" cut and paste into Excel. Is there a way in which I can have the results
export to a file? Alternatively, is there a way in which I could import the results into an Excel
object which would make cutting and pasting easier. Or...is there some other way to be able to get
the results into Excel for the user? Thanks! Bob
 
B

bobs

All, thanks for responding. I was looking to provide the results to users (i.e not just locally to myself). The idea is that users can go to a FP website, select data parameters, and cut and paste the results into Excel. The suggestion of using ODBC in Excel doesn't work well as not all users would have OCBC connectivity/access. I've figured out how to more efficiently cut and paste the data into Excel, however, if there as a way in which the results would allow users to "save to a file" or post into some kind of Excel object...that would be great. Regards, Bob
 
B

bobs

All, thanks for responding. I was looking to provide the results to users (i.e not just locally to myself). The idea is that users can go to a FP website, select data parameters, and cut and paste the results into Excel. The suggestion of using ODBC in Excel doesn't work well as not all users would have OCBC connectivity/access. I've figured out how to more efficiently cut and paste the data into Excel, however, if there as a way in which the results would allow users to "save to a file" or post into some kind of Excel object...that would be great. Regards, Bob
 
B

bobs

All, thanks for responding. I was looking to provide the results to users (i.e not just locally to myself). The idea is that users can go to a FP website, select data parameters, and cut and paste the results into Excel. The suggestion of using ODBC in Excel doesn't work well as not all users would have OCBC connectivity/access. I've figured out how to more efficiently cut and paste the data into Excel, however, if there as a way in which the results would allow users to "save to a file" or post into some kind of Excel object...that would be great. Regards, Bob
 
T

Thomas A. Rowe

Here is a sample of code that I use, however I do not use the FP database components other than to
create the database connection and the global.asa file via the Tools | Web / Site Settings |
Database. I also only work with System DSNs. So if you use FP database component or a DSNLess
connection, I can't help you will getting the following to work.

<%
Dim DSN_Name
DSN_Name = Application("connectionname_ConnectionString")
set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DSN_Name

Dim FName
FName = "filename.csv"

Set RS = Server.CreateObject("ADODB.Recordset")
Sql = "SELECT * FROM Tablename"
Set RS = Connection.Execute (sql)

Dim F, Head
For Each F In RS.Fields
Head = Head & ", " & F.Name
Next
Head = Mid(Head,3) & vbCrLf
Response.ContentType = "application/ms-excel"
Response.AddHeader "content-disposition", "filename= " & FName
Response.Write Head
Response.Write RS.GetString(,,",",vbCrLf,"")
%>

connectionname is the name of the DSN connection.

Filename is the name that will be assigned to each CSV file created, this should be easy to change
to accept a value via QueryString, or Form post.

Tablename is the name of the table in your database, and you can change the * which dumps all fields
to specific field if needed.
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================


bobs said:
All, thanks for responding. I was looking to provide the results to users (i.e not just locally to
myself). The idea is that users can go to a FP website, select data parameters, and cut and paste
the results into Excel. The suggestion of using ODBC in Excel doesn't work well as not all users
would have OCBC connectivity/access. I've figured out how to more efficiently cut and paste the data
into Excel, however, if there as a way in which the results would allow users to "save to a file" or
post into some kind of Excel object...that would be great. Regards, Bob
 
Top