I'm using Microsoft Query to retrieve data into Excel. I'm trying to build the SELECT statement so that it concatenates newline (carriage return) characters in the results, but the newline characters are being ignored. Yes, I have word wrap enabled, and the cell width is smaller than the data. I've tried multiple combinations of line feed (CHAR(10) or hex 0A) and form feed (CHAR(13) or hex 0D), but none of them work. I've tried all of these:
SELECT TRIM(cnam05) || X'0D' || X'0A' ||
TRIM(cad105) || X'0D' || X'0A' ||
TRIM(cad205) || X'0D' || X'0A' ||
TRIM(cad405) || X'0D' || X'0A' ||
TRIM(cad505) as "Customer Address",
SELECT TRIM(cnam05) || X'0A' || X'0D' ||
TRIM(cad105) || X'0A' || X'0D' ||
TRIM(cad205) || X'0A' || X'0D' ||
TRIM(cad405) || X'0A' || X'0D' ||
TRIM(cad505) as "Customer Address",
SELECT TRIM(cnam05) || X'0A' ||
TRIM(cad105) || X'0A' ||
TRIM(cad205) || X'0A' ||
TRIM(cad405) || X'0A' ||
TRIM(cad505) as "Customer Address",
SELECT TRIM(cnam05) || X'0D' ||
TRIM(cad105) || X'0D' ||
TRIM(cad205) || X'0D' ||
TRIM(cad405) || X'0D' ||
TRIM(cad505) as "Customer Address",
All of the above create the same results: a concatenated address, like this:
MY CUSTOMER123 MAIN STSOMETOWN NY
I need the results to look like this:
MY CUSTOMER
123 MAIN ST
SOMETOWN
NY
I can easily accomplish the above with a VBA macro. But I'd like to know how to resolve this "newline issue" with just a query.
Any suggestions?
Oh, and I've googled the hell out of this issue. I found lots of suggestions for Ctrl+Enter and formulas, but those don't apply to my issue.
TIA
Tom
Bookmarks