I am creating a NACHA file. I have the format and have created the lines I
need to export. The info is stored into an array and a few varriables. I
need to send this data to a txt file and store it.
I have 2 questions.
1) how do I create and drop data from the VB part of Access into the Text
file?
2) how can I format the TXT file so that I can have 94 characters per line in
Landscape?
TIA for any help.
Hi Mark,
>I am creating a NACHA file. I have the format and have created the lines I
>need to export. The info is stored into an array and a few varriables. I
[quoted text clipped - 4 lines]
>1) how do I create and drop data from the VB part of Access into the Text
>file?
Here's one way:
Dim strFileSpec As String
Dim blOverwrite As Boolean
Dim lngFN As Long
Dim strLine As String
...
lngFN = FreeFile()
If blOverwrite Then
Open strFileSpec For Output As #lngFN
Else
Open strFileSpec For Append As #lngFN
End If
'write a line to the file
strLine = "blah blah blah"
Print #lngFN, strline
'repeat as required
Tidy up
Close #lngFN
>2) how can I format the TXT file so that I can have 94 characters per line in
>Landscape?
You can use expressions like these to format the contents of a variable
as a string of a given length:
Format(X, "000000.00") 'Right-aligns numeric value X with 2
decimal places in a 9-column field
padded with 0s
Left(S & Space(20), 20)'Left-aligns string S in a 20-column
field padded with spaces
There's nothing in a text file to say whether it's portrait or
landscape: that's a decision for any software that may print it.
>TIA for any help.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Mark C - 26 Jul 2005 14:54 GMT
Thanks a ton for the help
>Hi Mark,
>
[quoted text clipped - 50 lines]
>
>Please respond in the newgroup and not by email.