473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Forced line breaks in Excel do not import correctly into Access

35 32bit
I have a problem when I try to import an Excel 2007 spreadsheet in Access. Some cells in the spreadsheet contain text with forced line breaks but when I import the data in Access the line breaks are substituted by small square boxes. Does anyone know how I can prevent this from happening without having to edit all entries manually?

Thanks in advance!
Mar 12 '10 #1
5 12019
TheSmileyCoder
2,322 Expert Mod 2GB
That is because Excel uses Chr(10) for a linebreak and Access uses Chr(10)+Chr(13)
I think one is called Carriage Return, and one is called LineFeed, but I dont know which is which :P

Now, there may be a smarter way of doing this. What I did was import to a temp table, and then run a update query on the temp table setting the field in question:
Expand|Select|Wrap|Line Numbers
  1. =Replace(myField, chr(10), chr(13) & chr(10))
Now the reason why I do this in a temp table, is that if I performed that query on my main table, I would be adding alot of extra line breaks each time I ran the query. After running the update query, I then import the temptable to my main table, and clear out the temptable. All of this is done via VBA coding.
Mar 12 '10 #2
NeoPa
32,556 Expert Mod 16PB
Expand|Select|Wrap|Line Numbers
  1. Chr(10)           == vbLF      == Line Feed (LF)
  2. Chr(13)           == vbCR      == Carriage Return (CR)
  3. Chr(13) & Chr(10) == vbCrLf    == Carriage Return/Line Feed (CR/LF)
  4.                   == vbNewLine == New Line
On PCs using Windows the standard line separator sequence is Carriage Return/Line Feed. On Unix type boxes the standard is a simple Carriage Return.

I don't think this is your issue though. Excel too, uses CR/LF, but it has the facility to store multiple lines accurately in a cell by using LF. As this is correct and sensible behaviour, it would seem a good idea to explain what you mean by "prevent this from happening". Are you looking to convert the data, after it's been imported into an Access table, into CR/LFs?
Mar 13 '10 #3
jschn
1
Just to add to this...

When I tried this in Access 2010 it did not work with:

chr10 & chr13 as in TheSmilerCoder example.

It had to be as above in NeoPa which is:

chr13 & chr10

That worked fine...
Jun 3 '13 #4
NeoPa
32,556 Expert Mod 16PB
CR followed by LF dates back to when tele-type machines were used (TTY: ==> TeleTYpe device). The CR would take far longer to execute (as the print head had to return a greater distance) than the LF, but the LF could work even while the CR was still returning (the Carriage). Thus, the total elapsed time was only the time it took the Carriage to Return.
Jun 5 '13 #5
TheSmileyCoder
2,322 Expert Mod 2GB
Thank you jschn for reporting this. I have corrected my post.
Jun 6 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: intl04 | last post by:
I have a memo field that is included in some Access reports I created. Is there some way for the memo field to display nicely formatted text, with line breaks between paragraphs? Or is it necessary...
2
by: nutthatch | last post by:
I want to be able to import an Excel spreadsheet into Access 2K using the macro command Transferspreadsheet. However, the file I am importing (over which I have no control) contains some records...
0
by: Soundneedle | last post by:
(AC2003, XL2003) Can anyone explain how I can get the transferspreadsheet function to upload a sheet that has number for the field names? Access converts the field header to "F##". In other...
9
by: jillandgordon | last post by:
I am trying to import an excel file into Access 97. It looks perfectly all right but, every time I try to import it, I get to the lst step and am told that it was not imported due to an error. ...
7
by: Smitty | last post by:
I have a function that imports an Excel file into an Access table using SQL. I then close the OleDataReader and the OleDbConnection, then dispose the OleDbCommand, then OleDbConnection. The calling...
6
by: David | last post by:
We have VS2005 ASP.NET 2.0 application that needs to have each paragraph separated by a line break. I have added "<br />" into the text column (SQL 2000) and it works fine when displaying on a web...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
1
by: baling | last post by:
Hi.... Hi everybody, i have a code that i make in VBA and know I want to use this code in to VB6. But i don't know how to use that code in to VB 6.0 Please correct this code so i can use it in VB...
6
by: jalmar | last post by:
Hello again: My second question is: I am linking an excel spreadsheet into Access, I have it linked and at first had problems getting the information imported into Access-it wasn't importing-I...
3
by: inepu | last post by:
I have some excel sheets that I would like to manage in access. I've created the access tables and relationships; the excel sheet is only one table and with duplicate data, I'd like to make sure that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.