Line Break in Text box with control source

C

cathywoodford

Hi. I have a text box that is linked to a text field in a table. I
have imported the table from Excel. In the cell in excel I had to hit
"ALT + ENTER" to get a new line for each number. For example the cell
looked like this: 1. jdafljkds;fasd
2.
jadlfjsdlajfalsdjfl
3. jasdfljksadflj
With each number being on a different line but in the same cell. My
problem is that when I imported this into access, it doesn't recognize
the line breaks and puts it in the text box as 1 line with boxes when
the line breaks should be. Is there anyway for me to fix this? I need
all numbered lines to be on their own line and I have a lot of fields
like this.

Hope someone can help.

Cathy
 
R

Rick Brandt

Hi. I have a text box that is linked to a text field in a table. I
have imported the table from Excel. In the cell in excel I had to hit
"ALT + ENTER" to get a new line for each number. For example the cell
looked like this: 1. jdafljkds;fasd
2.
jadlfjsdlajfalsdjfl
3. jasdfljksadflj
With each number being on a different line but in the same cell. My
problem is that when I imported this into access, it doesn't recognize
the line breaks and puts it in the text box as 1 line with boxes when
the line breaks should be. Is there anyway for me to fix this? I
need all numbered lines to be on their own line and I have a lot of
fields like this.

Hope someone can help.

Cathy

Access uses Chr(13) and Chr(10) for line breaks whereas (I think) Excel only
uses Chr(10). You should be able to run an update query using the Replace
function to replace all instances of Chr(10) with Chr(13) & Chr(10).
 
C

cathywoodford

Thanks for the quick response. Where would I run this query to? I'm
new at this stuff so I hope you can bare with me!

Cathy
 
F

fredg

Thanks for the quick response. Where would I run this query to? I'm
new at this stuff so I hope you can bare with me!

Cathy

If your version of Access (A 2000 or newer) supports the Replace Function, run an Update query.
Back up your table first......
On the main database folder, select Query.
Click on New.
Select Design View and the table from the New Query dialog.

When the Query design opens, click on the Query Tool Button.
Select Update Query.

On the Field Line of the lower panel grid, enter the name of the field you wish to update.
On the Update To: line, write:

Replace([FieldName],chr(10),Chr(13) & Chr(10))

Run the query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top