Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Transfertext to export 2 queries and merge/append in 1 text file 1

Status
Not open for further replies.

startup

Technical User
May 22, 2002
42
US
I have two queries different queries which are currently exporting to two separate text files with Transfertext. Is there any way I can make the second query append its results to the end of of the text file created by the first query? There is not a way to combine all the results in a single query in Access, so I have to resort to doing it in the text file but I don't know how.

Thanks,
Rico
 
A union query is nice, but in my case it won't work. The website listed states this: "all queries in a UNION operation must request the same number of fields; however, the fields don't have to be of the same size or data type."

My two queries have a different number of fields.
 
Then create some dummy expressions in the query with less fields, e.g.
Code:
SELECT CustomerName, "" AS Expr1, "" AS Expr2
FROM tblName
...
is a query that returns three columns, the last two fo which are empty.
 
Thanks for the idea mp9. That looks like it would work.

I did resolve the problem myself by creating a batch file that copied the two files into one with the statement "Copy C:\Temp\NewAdditions.txt + C:\Temp\NewDrops.txt C:\Temp\Merged.txt"

I then call this from VB with the code:

Shell "H:\D2L\merge.bat"
DoEvents

Maybe not the most efficient way to do things, but it got the job done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top