creating 1 excell sheet from two data sources

havey

New Member
Joined
Sep 23, 2002
Messages
2
Why can't i create 1 master .xls compatable file from the two data sources? How can i accomplish this?



Response.buffer = true Response.ExpiresAbsolute = Now() - 1 Response.Expires = 0
appID = Request.Form("appID")
ID = Request.Form("ID") %>

nRandom = Int((1000000 - 1 + 1) * Rnd + 1000000)
fileExcel = "t" & CStr(nRandom) & ".xls"
filePath= Server.mapPath("fpdb") filename=filePath & "" & fileExcel
Set fs = Server.CreateObject("Scripting.FileSystemObject") Set MyFile = fs.CreateTextFile(filename, True)
Set cn = Server.CreateObject("ADODB.Connection") cn.Open "DBQ=" & Server.MapPath("db.mdb") & ";" & _ "DRIVER=Microsoft Access Driver (*.mdb)" sql = "select * from Results where ID IN ("&ID&") UNION ALL select * from Results2 where appID IN ("&appID&")"
Set rs = cn.Execute(sql)
rs.Close

strLine="" 'Initialize the variable for storing the filednames
For each x in rs.fields
'Separate field names with tab so that these appear in
'different columns in Excel strLine= strLine & x.name & chr(9)
Next
'Write this string into the file MyFile.writeline strLine
'Retrieve the values from the database and write into the database
Do while Not rs.EOF strLine=""
for each x in rs.Fields strLine= strLine & x.value & chr(9)
next
MyFile.writeline strLine rs.MoveNext
Loop
MyFile.Close
Set MyFile=Nothing
Set fs=Nothing
link="Open Excel"
Response.write link %>
This message was edited by havey on 2002-09-24 02:49
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,392
Messages
6,119,254
Members
448,879
Latest member
oksanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top