I've got a few fields that I need to keep to one line, but not one word. Most are First Name, Last Name fields. I want to make sure users can't enter a carriage return OR any other random characters, such as another name. BUT entering 2 or more words (names) on one line is okay.... examples
I want to prevent this: John¶ (carriage return) Jimmy And this: John¶ (carriage return) But I want to allow this: Mary Alice After digging around in the text functions for awhile, I didn't find an "out of the box" solution, so I searched Brian Dunnings Custom Functions list but couldn't find what I was looking for. I'm sure it's there and I just didn't hit the right search parameters. Anyway, so I came up with my own custom function that is working.... since I'm not too good at righting those, so I was thrilled it worked. It might be a bit over blown with checking for 10 carriage returns, but I figured somebody's keyboard might get stuck. I threw in the trim after I got everything working to also get rid of leading/trailing spaces. The function below works, but I was wondering, is there an easier way to figure the number of words someone might throw in there? Like a >1 function? I tried that: ["¶"&RightWords ( TrimField ; >1 ) ; ""] but obviously the syntax isn't right. Is there an easier way? Trim ( Substitute ( TrimField ; ["¶"&RightWords ( TrimField ; 10 );""]; ["¶"&RightWords ( TrimField ; 9 );""]; ["¶"&RightWords ( TrimField ; 8 );""]; ["¶"&RightWords ( TrimField ; 7 );""]; ["¶"&RightWords ( TrimField ; 6 );""]; ["¶"&RightWords ( TrimField ; 5 );""]; ["¶"&RightWords ( TrimField ; 4 );""]; ["¶"&RightWords ( TrimField ; 3 );""]; ["¶"&RightWords ( TrimField ; 2 );""]; ["¶"&RightWords ( TrimField ; 1 ) ; ""]; ["¶" ; ""] )) Thanks, Rick ___________________ Rick O’Quinn Photographic Services Coordinator University of Georgia Public Affairs Broadcast, Video & Photographic Services 188 Georgia Center Athens GA 30602-3603 Work: (706) 542-8085 Fax: (706) 583-0011 [email protected] http://www.photo.alumni.uga.edu
