Remove Carriage Returns/Line Breaks in Field As Soon As Pasted. (1 Viewer)

zashaikh

Registered User.
Local time
Today, 11:22
Joined
Apr 28, 2017
Messages
13
I regularly copy and paste external data into a memo field in my DB. However, this external data always has carriage returns. How can I make it so that AS SOON AS I paste it into the field, the carriage returns are removed?

I'd rather the code run as soon as the text is pasted as opposed to an After_Update event. But I do not know what Event I would use, nor the VBA code necessary.

I think this is the code I need:
Replace([YourFieldNameHere],Chr(13) & Chr(10),""


But I don't know the correct Event. Dirty? Before Update? On Focus?
 

jdraw

Super Moderator
Staff member
Local time
Today, 14:22
Joined
Jan 23, 2006
Messages
15,364
cross posted at http://www.accessforums.net/showthread.php?t=69822

When you cross post, tell readers that you have done so, and identify the other post(s) by means of a link.

What exactly do you mean by this?
I'd rather the code run as soon as the text is pasted as opposed to an After_Update event.

When you paste some text into a field (should be a control), what event(s) do you think occur? Focus on WHAT you want, not on How it might be done.
 
Last edited:

missinglinq

AWF VIP
Local time
Today, 14:22
Joined
Jun 20, 2003
Messages
6,423
The OnChange event fires before the BeforeUpdate and before the AfterUpdate event when pasting data into a Control.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom