Solved

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

Posted on 2012-03-30
3
370 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now