Joe4
MrExcel MVP, Junior Admin
- Joined
- Aug 1, 2002
- Messages
- 72,171
- Office Version
- 365
- Platform
- Windows
I am using Access VBA to create a "MainFrame"-type file. For those of you who are unfamiliar with "MainFrame" type files, here are the important details:
1. There are three sections, Header (one row at top), Details, and Trailer (one row at bottom)
2. The records are Fixed Width
3. All records must be the same length
The issue is that the record length is often quite long (1500 in my current project), and the format of the Header, Details, and Trailer records are not remotely the same.
So what I have done is I have created three queries, one for each section, and then exported each to a text file, i.e.
tmpHeader
tmpDetails
tmpTrailer
Now, what I would like to do is "combine" these three text files together to make my one, single, complete MainFrame file.
I can do this pretty easy if I create in a one line DOS Batch file (using the COPY command). I also know I could create recordsets in VBA and loop through each, and write out each field, but with the size of each record, that doesn't seem to be the most efficient way to go.
So I am looking for a simple way to do this in Access VBA that is similiar to how I would do it in a DOS batch file, but I can quite figure out how the syntax for. I have been Googling the web, but still haven't found what I am looking for yet.
Does anyone know how to do this?
1. There are three sections, Header (one row at top), Details, and Trailer (one row at bottom)
2. The records are Fixed Width
3. All records must be the same length
The issue is that the record length is often quite long (1500 in my current project), and the format of the Header, Details, and Trailer records are not remotely the same.
So what I have done is I have created three queries, one for each section, and then exported each to a text file, i.e.
tmpHeader
tmpDetails
tmpTrailer
Now, what I would like to do is "combine" these three text files together to make my one, single, complete MainFrame file.
I can do this pretty easy if I create in a one line DOS Batch file (using the COPY command). I also know I could create recordsets in VBA and loop through each, and write out each field, but with the size of each record, that doesn't seem to be the most efficient way to go.
So I am looking for a simple way to do this in Access VBA that is similiar to how I would do it in a DOS batch file, but I can quite figure out how the syntax for. I have been Googling the web, but still haven't found what I am looking for yet.
Does anyone know how to do this?