View Full Version : Write access query to text file
bodanon
06-25-2003, 07:42 AM
I would like to make a recordset query based on session id in an Access database table, and output it to a text, html, or word file.
Can some one show me an example of how this is done?
chinnababu
06-25-2003, 09:41 AM
Set cn = createobject("adodb.connection")
cn.Open "dsn=northwind"
Set rs = CreateObject("adodb.recordset")
sql = "select * from customers"
rs.Open sql, cn
Dim fso, fn
Set fso = CreateObject("scripting.filesystemobject")
Set fn = fso.CreateTextFile("c:\testing100.txt", true)
Do until rs.EOF
fn.write rs("customerid") & "," & rs("country")
fn.writeblanklines 1
rs.MoveNext
Loop
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.