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
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