troubleshooting Question

Access VBA - Remove Empty Lines

Avatar of Mark01
Mark01Flag for United States of America asked on
Microsoft AccessVBA
11 Comments4 Solutions19 ViewsLast Modified:
I am using the code shown below in the AfterUpdate event of a text box to remove empty lines, but all of the carriage returns are deleted. I want to eliminate the empty lines in a text box because I use paragraph styles in another app to control the space between paragraphs. Please help. Here are examples of what happens.

Author = Replace([Author], Chr(10), "")
Author = Replace([Author], Chr(13), "")

Original text:
line 1
line 2

After AfterUpdate event runs:
line 1line 2

Desired behavior:
line 1
line 2
Join our community to see this answer!
Unlock 4 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros