Need to prevent people entering a return when they paste data (1 Viewer)

malfiscious

Registered User.
Local time
Today, 07:41
Joined
Feb 15, 2013
Messages
24
I've just come accross a problem where pasted data dissapears from view. It's caused by people being a bit careless and copying the line above (from word or notepad for example), which adds a return and then the data drops out of view.

I really want to create a validation rule to make it impossible for returns to be pasted but I'm not sure how. This is probably a really dumb question but any help is appreciated.

Thanks
 

pr2-eugin

Super Moderator
Local time
Today, 07:41
Joined
Nov 30, 2011
Messages
8,494
Try the control AfterUpdate event and use Replace() method to remove all carriage returns.. Something along the lines of..
Code:
Private Sub [COLOR=Blue]controlName[/COLOR]_AfterUpdate()
    Me.[COLOR=Blue]controlName[/COLOR] = Replace(Me.[COLOR=Blue]controlName[/COLOR], vbCrLf, "")
End Sub
Where controlName represents the name of the control the data is pasted into..
 

malfiscious

Registered User.
Local time
Today, 07:41
Joined
Feb 15, 2013
Messages
24
Perfect!!! Works like a charm...thanks very much!
 

Users who are viewing this thread

Top Bottom