471,355 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Pasting Dissimilar Records into One Text File

I need to copy records from several different tables into one text file.
Although the tables have many common fields, they also contain several that
are different from table to table. I can copy and paste the dissimilar
records manually into the text file, so it would seem that should be
possible to do programatically.

I set up export specifications for each of the twelve tables and tried to
export each to the same text file. This resulted in the first tables records
being exported, but nothing at all happened with any table after that. Not
even an error message. (I switched the order of the exporting and each time
only the first table would export.) I next tried seperate export files for
each of the tables in the export specifications and that worked, but I had
twelve seperate text files. I also tried a TransferText on queries, but that
too resulted in only the first queries records being exported to the text
file and none after that.

So now I'm thinking the only way to do this is with some code and I haven't
a clue as to where to start. Can somebody give me a big shove in the right
direction, or does anybody know of a sample of something similar that I
could look at?

Thanks.
Mar 1 '07 #1
2 1717
Steve Cartnal wrote:
I need to copy records from several different tables into one text file.
Although the tables have many common fields, they also contain several that
are different from table to table. I can copy and paste the dissimilar
records manually into the text file, so it would seem that should be
possible to do programatically.

I set up export specifications for each of the twelve tables and tried to
export each to the same text file. This resulted in the first tables records
being exported, but nothing at all happened with any table after that. Not
even an error message. (I switched the order of the exporting and each time
only the first table would export.) I next tried seperate export files for
each of the tables in the export specifications and that worked, but I had
twelve seperate text files. I also tried a TransferText on queries, but that
too resulted in only the first queries records being exported to the text
file and none after that.

So now I'm thinking the only way to do this is with some code and I haven't
a clue as to where to start. Can somebody give me a big shove in the right
direction, or does anybody know of a sample of something similar that I
could look at?

Thanks.

Let's say T1 has fields F1, F2, F3
T2 has fields F1, F2, F3, F4

YOu could
Select F1, F2, F3, Null As F4 From T1
UNION ALL
Select F1, F2, F3, F4 From T1
to combine the two tables together.

Would this concept work?
Mar 1 '07 #2
Sounds like a good time for a loop.

Dim iFile as integer

iFile = FreeFile
Open sScrFile For Output As iFile

'Perform this loop for each table
for X = 1 to 12

...Open your table, write to an array or directly to the text file
i.e. Print #iFile, SomeFieldFromSomeTable

next X

Close #iFile
On Mar 1, 1:00 am, "Steve Cartnal" <scart...@alltel.netwrote:
I need to copy records from several different tables into one text file.
Although the tables have many common fields, they also contain several that
are different from table to table. I can copy and paste the dissimilar
records manually into the text file, so it would seem that should be
possible to do programatically.

I set up export specifications for each of the twelve tables and tried to
export each to the same text file. This resulted in the first tables records
being exported, but nothing at all happened with any table after that. Not
even an error message. (I switched the order of the exporting and each time
only the first table would export.) I next tried seperate export files for
each of the tables in the export specifications and that worked, but I had
twelve seperate text files. I also tried a TransferText on queries, but that
too resulted in only the first queries records being exported to the text
file and none after that.

So now I'm thinking the only way to do this is with some code and I haven't
a clue as to where to start. Can somebody give me a big shove in the right
direction, or does anybody know of a sample of something similar that I
could look at?

Thanks.

Mar 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Henry Townsend | last post: by
1 post views Thread by Grant Smith | last post: by
5 posts views Thread by exhuma.twn | last post: by

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.