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

Export Multiple Tables into Fixed Width TXT file Sorted

P: 3
Hi all,

Took a CSV file which was then imported into a temporary table. Separated the initial table into 3 tables with width defined for each field.

Now need to export data into one TXT file.

Example:
01table one detailshere
02table two detailshere
03table thre detailshere
01next record deatilshere
02next record detailshere
03
01

I cannot combine them into one table as the width is not the same, so thinking i need to use VBA with a SQL statement.

Ultimately just used access/tables for temporary storage for reformatting the CSV file.

Any help greatly appreciated.
Thanks in advance!
Feb 25 '13 #1
Share this Question
Share on Google+
5 Replies


Rabbit
Expert Mod 10K+
P: 12,355
You can use a union query and then just use the largest width.
Feb 26 '13 #2

P: 3
Thanks for the response, problem is, that it needs to come out as a fixed width with the proper field length.

01ACCT# PATNAMEPAT ADDRESS.......
02ACCT# GUARNAMGUARANT ADD.....
03ACCT# INSNUMBERINSNAME....
01ACCT2 PATNAMEPAT ADDRESS.......
02ACCT2 GUARNAMGUARANT ADD......
03ACCT2 INSNUMBERINSNAME....01ACCT# 01ACCT3 PATNAMEPAT ADDRESS.......
02ACCT# GUARNAMGUARANT ADD......
03ACCT# INSNUMBERINSNAME....

I hope that helps a bit more
Feb 26 '13 #3

Rabbit
Expert Mod 10K+
P: 12,355
I know. That's why you should use a union query and then use the largest width of the mutliple queries to create your fixed width.
Feb 26 '13 #4

P: 3
Sorry for the late response as I had to go out of town. Problem with the Union is that the columns do not match.
Feb 28 '13 #5

Rabbit
Expert Mod 10K+
P: 12,355
If the columns don't match, then you no longer have a fixed width text file. You just have a text file of text with no way to discern what field is what.
Feb 28 '13 #6

Post your reply

Sign in to post your reply or Sign up for a free account.