Hi Dave and Ken,
Access's export routine automatically terminates the last record with
RLF, and I don't know any way of preventing it. If you can't tweak DB2's
import routine you can just delete the terminal CRLF, e.g. with this
Perl command; (if Perl isn't on your machine it's probably on the one
that runs DB2):
perl -pe "chomp; $_ = $.==1? qq($_): qq(\n$_);" filename.txt > new.txt
For an all-Access solution you could export the file in the usual way
and then use the VBA file I/O commands to open it and process it line by
line, outputting the CRLF at the beginning of each record after the
first rather than at the end of every record; or else write VBA to open
a recordset on your query and work through that, assembling the fields
into a fixed width string and writing them to disk without the terminal
CRLF.
Hi Ken,
I've attached the SQL below.
SELECT *
from aliasDeletes
UNION select *
from alias
ORDER BY [add/del] DESC;
The results from this query are exported to a flat file
which is then uploaded into a DB2 table. The last line,
even though there is nothing in it, is creating a whole
record in the DB2 table which is empty.
Thanks for your assistance.
Dave
-----Original Message-----
Any chance that your union query is returning an empty record for that last
record? Seems very unusual to have a carriage return just be added to the
last record.
Post the SQL of your query and let's see what it's doing.
--
Ken Snell
<MS ACCESS MVP>
Hi all,
I have a union query that needs to be exported to a .txt
file for use in a different system. This is all straight
forward and working fine apart from one little problem.
I need to get rid of the last line in the text file to
simplify things. It seems that somewhere along the line, a
carriage return is being added at the end of the last
record.
Can anyone help with this problem?
Thanks in advance,
Dave
.