Make Access stop removing CR LF TAB hidden chars when importing Excel worksheet

Hoping someone has done this and has a nifty piece of VBA or knows how to use the Access External Data functionality that solves my issue. I have a very large Excel worksheet with several columns of data containing hidden chars TAB CR LF that must be preserved when importing to Access so the data does not display in a single line of text when end-users see it. The data will be displayed in a subform Datasheet View. I am using Access 2016. Right now Access is removing the above hidden characters during the import, it does however keep the Space hidden character intact. The Excel column data is large enough it must be loaded as Long Text. Not all columns in my spreadsheet contain the above data, just a few specific ones. Has anyone seen this and solved it? tia, Marc
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
hmm, sure? Can you provide a sample Excel?
Also keep in mind, that the characters maybe there, but not displayed like the manual line break in Excel. This is a LF, which is not shown but in the data.


SELECT [yourColumn], Replace([yourColumn];Chr(10);"¶") FROM yourTable;

Open in new window

marcthibAuthor Commented:
Sure! see attached Excel file.  Here is more info, let me know if the screen shots do not make it over.

Excel data prior to importing to Access, F2 on the cell shows the formatting within the cell
Excel data, F2 on the cell
Same data in Notepad++  in Hex view
Same Excel data, Notepad++ Hex view
After importing to Access, now shows as one line of text
Access one line of text
Same Access contents viewed in Notepad++ Hex view, 0d(CR) 0a(LF) 09(TAB) are now gone
Same Access data Notepad   Hex viewSampleExcelToLoadToAccess.xlsx
ste5anSenior DeveloperCommented:
hmm.. the problem is that the line break in Excel is a LF, not CRLF. Also how should be a tabulator interpreted without tab stop?:

Replace(Replace([CommodityNameVerbose_LT];Chr(10);Chr(13) & Chr(10));Chr(9);Space(4))

Open in new window

Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

marcthibAuthor Commented:
Thanks lots!   I'll give it a try!  Marc
marcthibAuthor Commented:
Hi ste5an,

I experimented with various amounts of Tabs in the data, the Replace handles them nicely.  One thing I am noticing is that if I double click the Query itself the output is perfect!  But if I open the form, the bottom two fields only display part of the data.  I checked all the properties on the fields but I cannot see why that is happening.  Any thoughts or suggestions?

Query output
Query Output looks great
Form does not display all data bottom two fields
Form partial data
thanks again! Marc
ste5anSenior DeveloperCommented:
Just set the Scrollbars property of the TextBox to Vertical only.
marcthibAuthor Commented:
Thanks ste5an!  I also saw in another post removing the "@" from the Format property lets all characters show up.  That and the vertical scroll bar were the final touches.  You have been great, your solution is wonderful!  Marc
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.