473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Appending Text file with a header record

I have a data application in a2k that I need to create two fixed width
text files and then combine them to a single file The first file is
header information and the second is transaction data. I have tried
and tried but just cant seem to get this right, I am using Queries to
created my export files with specifications which works fine, I get
stumped with the appending the header to my transaction file. What I
have so far looks like this .. What I wind up in my file is,

1 2003100713250020441007
"c:\Trans.Txt"

What I need to know is how to declare the c:\trans.txt so it will
append data and not the string

Any help would be great!

Thanks

Michael

+++++++++++++++++++++++++++++++++++++++++++++++++

Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append As #1
Write #1, strPath1
Close #1

End sub
Nov 12 '05 #1
16 12570
The variable strPath1 is holding the name and path of the file, not the file itself, so
that is what is being appended. To append the data from the file, you will need to open
the file and use a Get statement to read the file and then append that data. You could use
a Do loop to run the read/append until EOF.

In the second TransferText call, what would happen if instead acExportFixed you used
acExportMerge, I don't see a good explanation of what each of these constants do.

--
Wayne Morgan
"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
I have a data application in a2k that I need to create two fixed width
text files and then combine them to a single file The first file is
header information and the second is transaction data. I have tried
and tried but just cant seem to get this right, I am using Queries to
created my export files with specifications which works fine, I get
stumped with the appending the header to my transaction file. What I
have so far looks like this .. What I wind up in my file is,

1 2003100713250020441007
"c:\Trans.Txt"

What I need to know is how to declare the c:\trans.txt so it will
append data and not the string

Any help would be great!

Thanks

Michael

+++++++++++++++++++++++++++++++++++++++++++++++++

Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append As #1
Write #1, strPath1
Close #1

End sub

Nov 12 '05 #2
Mi******@HotMail.Com (Michael) wrote in message news:<43**************************@posting.google. com>...
I have a data application in a2k that I need to create two fixed width
text files and then combine them to a single file The first file is
header information and the second is transaction data. I have tried
and tried but just cant seem to get this right, I am using Queries to
created my export files with specifications which works fine, I get
stumped with the appending the header to my transaction file. What I
have so far looks like this .. What I wind up in my file is,

1 2003100713250020441007
"c:\Trans.Txt"

What I need to know is how to declare the c:\trans.txt so it will
append data and not the string


I think the problem is that you may need to output the two queries to
text first. Then you can open one for append and the other for read.
Read each line of the first and write it to the second. then you
should be off an running... I'm kinda wondering if you can't use
SPACE(intSpaces) to create your own delimited text file, because then
you can just open a text file, loop through the records in your
query's recordset, write the records to the file, close the first
query, open the second, repeat the output stuff, and then append the
path or whatever just using a write statement... I think this is just
a limitation of the TransferText method - it assumes one output file
per object.
Nov 12 '05 #3
What would happen if your output query was a Union query, combining both outputs into one
query?

--
Wayne Morgan
Nov 12 '05 #4
Wayne,

Your first idea is exactly what I need to do, though I am unclear how
to write the code to accomplish this. I have the two files outputting
correctly, I just need to append the first (header.txt) to the second
(trans.txt) Do you think you could provide an example?

Thanks for your help,

Michael
"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<hO******************@newssvr32.news.prodigy. com>...
The variable strPath1 is holding the name and path of the file, not the file itself, so
that is what is being appended. To append the data from the file, you will need to open
the file and use a Get statement to read the file and then append that data. You could use
a Do loop to run the read/append until EOF.

In the second TransferText call, what would happen if instead acExportFixed you used
acExportMerge, I don't see a good explanation of what each of these constants do.

--
Wayne Morgan
"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
I have a data application in a2k that I need to create two fixed width
text files and then combine them to a single file The first file is
header information and the second is transaction data. I have tried
and tried but just cant seem to get this right, I am using Queries to
created my export files with specifications which works fine, I get
stumped with the appending the header to my transaction file. What I
have so far looks like this .. What I wind up in my file is,

1 2003100713250020441007
"c:\Trans.Txt"

What I need to know is how to declare the c:\trans.txt so it will
append data and not the string

Any help would be great!

Thanks

Michael

+++++++++++++++++++++++++++++++++++++++++++++++++

Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append As #1
Write #1, strPath1
Close #1

End sub

Nov 12 '05 #5
Try this, some of it will depend on the way your data is formatted. This can be adjusted
to read specific record lengths, put quotes around text or not put quotes (use Print
instead of Write), etc. I currently have it reading one line at a time.
Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strData As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1
Open strPath1 For Append Access Write As #1
Open strPath2 For Binary Access Read As #2

Do
Line Input #2, strData
Write #1, strData
Loop Until EOF(2)

Close #1
Close #2

End sub
--
Wayne Morgan
"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
Wayne,

Your first idea is exactly what I need to do, though I am unclear how
to write the code to accomplish this. I have the two files outputting
correctly, I just need to append the first (header.txt) to the second
(trans.txt) Do you think you could provide an example?

Nov 12 '05 #6
"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<Ua******************@newssvr31.news.prodigy. com>...
What would happen if your output query was a Union query, combining both outputs into one
query?


If I create a Join Query the Header shows up in every Record. I need
the Header to appear at the top of the text file and also a Trailer at
t he bottom of the file.
Nov 12 '05 #7
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++
Wayne,

This seems to work, however I am getting a Run Time error '62' Imput
Past end of file, and it is putting quotes around my Transactions in
the merged file. Below is a sample of the output and the finished
code I am using.

Thanks again for all your help!

This is a sample of the out put, which is perfect except for the
quotes

1 2003100713250020441007
"OHD773050105220030927"
"OHD773051105220030927"
"OHD773052105220030927"

This is the finished code ..

Private Sub Command0_Click()
Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strData As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"
'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append Access Write As #1
Open strPath1 For Binary Access Read As #2

Do
Line Input #2, strData
Write #1, strData
Loop Until EOF(2)

Close #1
Close #2
End Sub

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++
"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<VE*****************@newssvr17.news.prodigy.c om>...
Try this, some of it will depend on the way your data is formatted. This can be adjusted
to read specific record lengths, put quotes around text or not put quotes (use Print
instead of Write), etc. I currently have it reading one line at a time.
Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strData As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1
Open strPath1 For Append Access Write As #1
Open strPath2 For Binary Access Read As #2

Do
Line Input #2, strData
Write #1, strData
Loop Until EOF(2)

Close #1
Close #2

End sub
--
Wayne Morgan
"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
Wayne,

Your first idea is exactly what I need to do, though I am unclear how
to write the code to accomplish this. I have the two files outputting
correctly, I just need to append the first (header.txt) to the second
(trans.txt) Do you think you could provide an example?

Nov 12 '05 #8
Mi******@HotMail.Com (Michael) wrote in message news:<43**************************@posting.google. com>...
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++
Wayne,

This seems to work, however I am getting a Run Time error '62' Imput
Past end of file, and it is putting quotes around my Transactions in
the merged file. Below is a sample of the output and the finished
code I am using.

Thanks again for all your help!

This is a sample of the out put, which is perfect except for the
quotes

1 2003100713250020441007
"OHD773050105220030927"
"OHD773051105220030927"
"OHD773052105220030927"

This is the finished code ..

Private Sub Command0_Click()
Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strData As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"
'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append Access Write As #1
Open strPath1 For Binary Access Read As #2

Do
Line Input #2, strData
Write #1, strData
Loop Until EOF(2)

Close #1
Close #2
End Sub

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++


Do Until EOF(2)
Line Input #2, strData
Write #1, strData
Loop

Close #1
Close #2

You just need to test for EOF first, I think. Of course, you have to
make sure then that you get the last record in textfile #1 into #2.
Nov 12 '05 #9
I don't know how to get rid of the quotes, I had to get this far through trial and error
and reading the not so informative help file. Perhaps, if you seek to the end of file #1
then do a Binary write to the file?

--
Wayne Morgan
"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++
Wayne,

This seems to work, however I am getting a Run Time error '62' Imput
Past end of file, and it is putting quotes around my Transactions in
the merged file. Below is a sample of the output and the finished
code I am using.

Thanks again for all your help!

This is a sample of the out put, which is perfect except for the
quotes

1 2003100713250020441007
"OHD773050105220030927"
"OHD773051105220030927"
"OHD773052105220030927"

This is the finished code ..

Private Sub Command0_Click()
Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strData As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"
'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append Access Write As #1
Open strPath1 For Binary Access Read As #2

Do
Line Input #2, strData
Write #1, strData
Loop Until EOF(2)

Close #1
Close #2
End Sub

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++
"Wayne Morgan" <co***************************@hotmail.com> wrote in message

news:<VE*****************@newssvr17.news.prodigy.c om>...
Try this, some of it will depend on the way your data is formatted. This can be adjusted to read specific record lengths, put quotes around text or not put quotes (use Print
instead of Write), etc. I currently have it reading one line at a time.
Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strData As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1
Open strPath1 For Append Access Write As #1
Open strPath2 For Binary Access Read As #2

Do
Line Input #2, strData
Write #1, strData
Loop Until EOF(2)

Close #1
Close #2

End sub
--
Wayne Morgan
"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
Wayne,

Your first idea is exactly what I need to do, though I am unclear how
to write the code to accomplish this. I have the two files outputting
correctly, I just need to append the first (header.txt) to the second
(trans.txt) Do you think you could provide an example?

Nov 12 '05 #10
I tried using the Do Until EOF but I get the same results. Funny
though I get my file correctly now or as soon as I reset after my
error I have a correctly formated file. But I still get a Run Time
Error Input past end of file on the last part of this routine. Anyone
have any ideas? I've added a second pass though to add a trailer file
to this and thats what's failing.

Thanks again to all!

Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strThirdQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strPath2 As String
Dim strData As String
strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strPath2 = "c:\Trailer.Txt" 'Trailer file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"
strThirdQuery = "QryTrailer"
'Output Transaction Header c:\Header.txt
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions c:\Trans.Txt
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1
'OutPut Transaction Trailer c:\Trailer.Txt
DoCmd.TransferText acExportFixed, "EE2", strThirdQuery, strPath2
Open strPath1 For Append Access Write As #2 ' Transactions
Open strPath2 For Binary Access Read As #3 ' Trailer

'Merge c:\Trans.Txt with C:\Trans.Txt This part works

Do
Line Input #3, strData
Print #2, strData
Loop Until EOF(2)

Close #2
Close #3

Open strPath1 For Binary Access Read As #1 ' Transactions
Open strPath For Append Access Write As #4 ' Header

'Merge C:\Trans.Txt with C:\Header.Txt
'This part fails with the Input past end of file error

Do Until EOF(1)
Line Input #1, strData '<< Error here
Print #4, strData
Loop 'While EOF(1) 'Until EOF(1)

Close #1
Close #4
End Sub

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++

Do Until EOF(2)
Line Input #2, strData
Write #1, strData
Loop

Close #1
Close #2

You just need to test for EOF first, I think. Of course, you have to
make sure then that you get the last record in textfile #1 into #2.

Nov 12 '05 #11
I tried using the Do Until EOF but I get the same results. Funny
though I get my file correctly now or as soon as I reset after my
error I have a correctly formated file. But I still get a Run Time
Error Input past end of file on the last part of this routine. Anyone
have any ideas? I've added a second pass though to add a trailer file
to this and thats what's failing.

Thanks again to all!

Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strThirdQuery As String
Dim strPath As String
Dim strPath1 As String
Dim strPath2 As String
Dim strData As String
strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strPath2 = "c:\Trailer.Txt" 'Trailer file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"
strThirdQuery = "QryTrailer"
'Output Transaction Header c:\Header.txt
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions c:\Trans.Txt
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1
'OutPut Transaction Trailer c:\Trailer.Txt
DoCmd.TransferText acExportFixed, "EE2", strThirdQuery, strPath2
Open strPath1 For Append Access Write As #2 ' Transactions
Open strPath2 For Binary Access Read As #3 ' Trailer

'Merge c:\Trans.Txt with C:\Trans.Txt This part works

Do
Line Input #3, strData
Print #2, strData
Loop Until EOF(2)

Close #2
Close #3

Open strPath1 For Binary Access Read As #1 ' Transactions
Open strPath For Append Access Write As #4 ' Header

'Merge C:\Trans.Txt with C:\Header.Txt
'This part fails with the Input past end of file error

Do Until EOF(1)
Line Input #1, strData '<< Error here
Print #4, strData
Loop 'While EOF(1) 'Until EOF(1)

Close #1
Close #4
End Sub

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++

Do Until EOF(2)
Line Input #2, strData
Write #1, strData
Loop

Close #1
Close #2

You just need to test for EOF first, I think. Of course, you have to
make sure then that you get the last record in textfile #1 into #2.

Nov 12 '05 #12
rkc

"Michael" <Mi******@HotMail.Com> wrote in message
news:43**************************@posting.google.c om...
I tried using the Do Until EOF but I get the same results.


Do While Not EOF(2)
Nov 12 '05 #13
rkc

----- Original Message -----
From: "Michael" <Mi******@HotMail.Com>
Newsgroups: comp.databases.ms-access
Sent: Tuesday, October 14, 2003 12:14 PM
Subject: Re: Appending Text file with a header record
<snip>
Open strPath1 For Append Access Write As #2 ' Transactions
Open strPath2 For Binary Access Read As #3 ' Trailer

'Merge c:\Trans.Txt with C:\Trans.Txt This part works

<code change>
Input$ ( lof(3), strData)
Print #2, strData
</code change>
Close #2
Close #3

Open strPath1 For Binary Access Read As #1 ' Transactions
Open strPath For Append Access Write As #4 ' Header

'Merge C:\Trans.Txt with C:\Header.Txt
'This part fails with the Input past end of file error

<code change>
Input$ (lof( 1) , strData)
Print #4, strData
</code change>
Close #1
Close #4
End Sub


Nov 12 '05 #14
When i try this ..

Input$ (lof( 1) , strData) << I get an Error here, "Compile Error Expected #"
Print #4, strData

Is this exactly how I should type this?

"rkc" <rk*@yabba.dabba.do.rochester.rr.com> wrote in message news:<rd*******************@twister.nyroc.rr.com>. ..
----- Original Message -----
From: "Michael" <Mi******@HotMail.Com>
Newsgroups: comp.databases.ms-access
Sent: Tuesday, October 14, 2003 12:14 PM
Subject: Re: Appending Text file with a header record
<snip>
Open strPath1 For Append Access Write As #2 ' Transactions
Open strPath2 For Binary Access Read As #3 ' Trailer

'Merge c:\Trans.Txt with C:\Trans.Txt This part works

<code change>
Input$ ( lof(3), strData)
Print #2, strData
</code change>
Close #2
Close #3

Open strPath1 For Binary Access Read As #1 ' Transactions
Open strPath For Append Access Write As #4 ' Header

'Merge C:\Trans.Txt with C:\Header.Txt
'This part fails with the Input past end of file error

<code change>
Input$ (lof( 1) , strData)
Print #4, strData
</code change>
Close #1
Close #4
End Sub

Nov 12 '05 #15
rkc

----- Original Message -----
From: "Michael" <Mi******@HotMail.Com>
Newsgroups: comp.databases.ms-access
Sent: Tuesday, October 21, 2003 6:48 PM
Subject: Re: Appending Text file with a header record

When i try this ..

Input$ (lof( 1) , strData) << I get an Error here, "Compile Error Expected #" Print #4, strData

Is this exactly how I should type this?

No. Don't know why I typed it like that.

strData = a variable of type string.

The following will cause the entire contents of the file opened as #1
to be loaded into strData.

strData = Input$(LOF(1), #1)

You should read up on the FreeFile function to assign a file handle.

Dim f1 as Long
f1 - FreeFile

Open "c:\Trans.Txt" For Binary As #f1


Nov 12 '05 #16
If anyone is interested here is how I solved my problem ..

Private Sub Command9_Click()

Dim strFirstQuery, strSecondQuery, strThirdQuery As String
Dim strPath, strPath1, strPath2 As String
Dim strData, strResult As String
Dim strtmp, strfulltmp As String

strPath = "c:\Header.txt" 'Header
Information file
strPath1 = "c:\Trans.Txt"
'Transactions file
strPath2 = "c:\Trailer.Txt" 'Trailer
file
strResult = "C:\Result.Txt" 'Result of
the three merged files

strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"
strThirdQuery = "QryTrailer"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1
'OutPut Transaction Trailer
DoCmd.TransferText acExportFixed, "EE2", strThirdQuery, strPath2

Open strPath For Input As #1 'Open Header
Open strPath1 For Input As #2 'Open Transactions File
Open strPath2 For Input As #3 'Open Trailer File
Open strResult For Output As #4 'Open Results File

Do While Not EOF(1)
Line Input #1, tmp
fulltmp = fulltmp & tmp & vbNewLine 'Read Header
Loop
Do While Not EOF(2)
Line Input #2, tmp
fulltmp = fulltmp & tmp & vbNewLine 'Read Transactions
Loop
Do While Not EOF(3)
Line Input #3, tmp
fulltmp = fulltmp & tmp & vbNewLine 'Read Trailer
Loop

Print #4, fulltmp 'Make Merged Results File

Close #4 'Close Files
Close #3
Close #2
Close #1
End Sub

Thanks for everyone's input!


Mi******@HotMail.Com (Michael) wrote in message news:<43**************************@posting.google. com>...
I have a data application in a2k that I need to create two fixed width
text files and then combine them to a single file The first file is
header information and the second is transaction data. I have tried
and tried but just cant seem to get this right, I am using Queries to
created my export files with specifications which works fine, I get
stumped with the appending the header to my transaction file. What I
have so far looks like this .. What I wind up in my file is,

1 2003100713250020441007
"c:\Trans.Txt"

What I need to know is how to declare the c:\trans.txt so it will
append data and not the string

Any help would be great!

Thanks

Michael

+++++++++++++++++++++++++++++++++++++++++++++++++

Private Sub Command0_Click()

Dim strFirstQuery As String
Dim strSecondQuery As String
Dim strPath As String
Dim strPath1 As String

strPath = "c:\Header.txt" 'Header Information file
strPath1 = "c:\Trans.Txt" 'Transactions file
strFirstQuery = "QryHeader"
strSecondQuery = "QryTransactions"

'Output Transaction Header
DoCmd.TransferText acExportFixed, "EE2", strFirstQuery, strPath
'OutPut Transactions
DoCmd.TransferText acExportFixed, "EE", strSecondQuery, strPath1

Open strPath For Append As #1
Write #1, strPath1
Close #1

End sub

Nov 12 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sven | last post by:
Hello, I am receiving a text file that is produced from a mainframe that is out of my control. I am attempting to find a (hopefully clean) way to import it into a SQL Server database in an...
5
by: Johnny Meredith | last post by:
I have seven huge fixed width text file that I need to import to Access. They contain headers, subtotals, etc. that are not needed. There is also some corrupt data that we know about and can...
6
by: EricR | last post by:
I am trying to bcp import a text file into a SQL Server 2000 database. The text file is coming out of a java application where order information is written to the text file. Each record is on it's...
1
by: ljungers | last post by:
Help needed with shell script using the sed command. Need to extract a date from a text file. Each record contains the text "Date Entered:" and following that literial is a space followed by...
4
by: sanparab | last post by:
I am a new user for MS Access 2003, I want to transfer a data of Fixed lenght text file into Access Tabel. The data is contained of four Record Set those are as follows 1. The header record...
2
by: Cliff72 | last post by:
I'm creating a database that will be uploading some text files into an access table. The problem is that the text files have a header which messes up my import specs. so what i have had to do is to...
3
by: maylee21 | last post by:
hi, anyone can help me figure out how to read data from a text file like this: 10980012907200228082002 and extract the data according to this kind of format: Record type 1 TY-RECORD ...
2
by: poolboi | last post by:
hi guys, i've got a problem in appending text file i'm creating a history log for people who use my my programs in my text file i got root Thu May 8 09:38:56 2008 Commands used: MIO:IMSI;...
4
by: grumpydadtl | last post by:
I am exporting a text file from Access that will be fed into a mainframe application (third party - not something I manage). The file contains a header record, body - which is the variable number of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.