Yes, you'll need the connection to the database. Easiest way to achieve this is via a DSN (Data Source Name) which can be setup by going to:
Control Panel --> ODBC --> System DSN --> Add
Then, just follow the Wizard. Give your DSN a name, point it to a database, tell it what kind of database it is, etc.
Now then, once you do that, I'll assume you have named your DSN 'myDSN', and your database is Access.
The following is ASP, and must be run in a server environment. Win9x is ok, but you must first have PWS installed. I'll leave that for another thread, if you need details there.
<%
'Here are your nuts and bolts
dim con, rs, sql, fso, txtFile
'connection to your database
set con = server.createObject("ADODB.Connection"
'recordset to hold your information
set rs = server.createObject("ADODB.Recordset"
'open your connection
con.open ("DSN=myDSN"

'<--- name of your DSN, obviously
'setup your select statement
sql = "SELECT * FROM someTable"
'declare your active connection for your recordset
rs.activeConnection = con
'open your recordset
rs.open sql
'AT THIS POINT, YOU HAVE A RECORDSET CONTAINING ALL
' RECORDS FROM THE TABLE, someTable.
'ADJUST YOUR SQL AS NEEDED TO FIT YOUR DATABASE
'create your file system object, which allows the
' creation of your txt file
set fso = server.createObject("Scripting.fileSystemObject"
'create your text file
' this will create a txt file in the same directory
' as your script called myTxtFile.txt
' You can adjust the path as needed
set txtFile = fso.createTextFile("myTxtFile.txt"
'write some info from your recordset to the txt file
txtFile.writeLine(rs("columnName"

)
'close your text file
txtFile.close
'clean up your mess
set txtFile = nothing
set fso = nothing
set rs = nothing
set con = nothing
%>
Check your text file, and you will have whatever was in the field, 'columnName', written on the first line.
Here's more information on the fileSystemObject:
hope that helps!

paul