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

zashaikh

Registered User
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
Joined
Jan 23, 2006
Messages
12,558
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
Joined
Jun 20, 2003
Messages
6,330
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 (Users: 0, Guests: 1)

Top Bottom