marcthib
asked on
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
ASKER
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
Same data in Notepad++ in Hex view
After importing to Access, now shows as one line of text
Same Access contents viewed in Notepad++ Hex view, 0d(CR) 0a(LF) 09(TAB) are now gone
SampleExcelToLoadToAccess.xlsx
Excel data prior to importing to Access, F2 on the cell shows the formatting within the cell
Same data in Notepad++ in Hex view
After importing to Access, now shows as one line of text
Same Access contents viewed in Notepad++ Hex view, 0d(CR) 0a(LF) 09(TAB) are now gone
SampleExcelToLoadToAccess.xlsx
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?:
EE29094702.accdb
Replace(Replace([CommodityNameVerbose_LT];Chr(10);Chr(13) & Chr(10));Chr(9);Space(4))
EE29094702.accdb
ASKER
Thanks lots! I'll give it a try! Marc
ASKER
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
Form does not display all data bottom two fields
thanks again! Marc
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
Form does not display all data bottom two fields
thanks again! Marc
Just set the Scrollbars property of the TextBox to Vertical only.
ASKER
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
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
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.
E.g.
Open in new window