Solved

Replace ", " with Return and Line Feed - Replace Function Microsoft Access

Posted on 2012-03-30
3
374 Views
Last Modified: 2012-03-30
Hi all,

I am importing a list of addresses into an Access table and a typical address is:
100 High Street, Some Town, Some County, Some Postcode

I need to use the replace function to get it to look like:
100 High Street
Some Town
Some County
Some Postcode

Am happy to replace function at query level to "a" with "b", but not sure how to handle the above regarding Returns and Linefeeds, Thanks
0
Comment
Question by:Paul-bbc
  • 2
3 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37786291
Use this In an update query:

UPDATE YourTable
SET YourField = Replace(YourField, ",", Chr(10) & Chr(13))

Make a backup before testing any action query.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37786295
Sorry - I've got that backwards.  It should be:

UPDATE YourTable
SET YourField = Replace(YourField, ",", Chr(13) & Chr(10))



Chr(13) & Chr(10)  is Carriage Return/Line Feed (the equivalent of vbCRLF in VBA programming)

You might also try this - which may avoid extraneous spaces in your data after breaking the lines apart (it replaces 'comma space' with CR/LF):

UPDATE YourTable
SET YourField = Replace(YourField, ", ", Chr(13) & Chr(10))
0
 

Author Closing Comment

by:Paul-bbc
ID: 37786319
Thanks, worked fine, just needed to amend to ", " i.e. include the space character to be replaced as well.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question