Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting to a text file using fixed length

Status
Not open for further replies.

APS

Vendor
Sep 25, 2000
53
0
0
US
I need to export records from an Access table to a text file in fixed length format. I was going to use transfertxt but I need to append it to an existing file. I tried using the write command but it will only do comma delimited and the print command isn't working either. Is there a way to do this?

Here is part of my code using write

absrs.MoveFirst
Open "c:\test.txt" For Append As #1
Do While Not absrs.EOF
i = 0
For Each fld In absrs.Fields
If IsNull(absrs.Fields(i)) Then
absrs.Fields(i) = " "
End If
fldvalue = absrs.Fields(i)
write #1, fldvalue,
i = i + 1
Next
write #1, Chr(13)
absrs.MoveNext
Loop
Close #1

Thanks,
Anthony
 
Define a fixed length record with the Type instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Any chance of getting a quick example? I've never used it before.

Thanks,
Anthony
 
When in VBE with the cursor inside the Type word press the F1 key.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Or you could look into the writeline method of the filesystemobject thread705-733508.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top