ExpAccessToAscii




Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(yourdatabasename)
Set rs = db.OpenRecordset(yourtablename)
'step 3:

Dim nFile%
Dim vFileName$
'vFileName$ = the name and location of the text file

nFile% = FreeFile
Open vFileName$ For Output As #nFile%
'step 4 / 5:

Dim counter%
Dim MaxFields%
MaxFields% = rs.Fields.Count - 1
Do While Not rs.EOF
For counter% = 0 To MaxFields%
If Not IsNull(rs.Fields(counter%).Value) Then _
Print #nFile, rs.Fields(counter%).Value
Next counter%
rs.MoveNext
Loop
'step 6:

rs.Close
db.Close
Close #nFile%
'This way you get all the value on a different line in your textfile.

'If you want the record on one line just change step 4/5 to

Dim counter%
Dim MaxFields%
MaxFields% = rs.Fields.Count - 1
Do While Not rs.EOF
For counter% = 0 To MaxFields%
If Not IsNull(rs.Fields(counter%).Value) Then _
Print #nFile, rs.Fields(counter%).Value;
Next counter%
Print #nFile,
rs.MoveNext
Loop
step 1: open the database
step 2: open the table/recordset/sql
step 3: open a textfile
step 4: go througt the table
step 5: write the value to the text file
step 6: Close Table / Database And textfile
step 1 / 2:










( expaccesstoascii.html )- by Paolo Puglisi - Modifica del 17/12/2023