By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Pasting Dissimilar Records into One Text File

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.