Normal Topic How to Avoid Ampersands being input (Read 358 times)
Stew Bell
Member
*
Offline



Posts: 21
Joined: Dec 17th, 2011
How to Avoid Ampersands being input
Jan 23rd, 2012 at 1:12am
Print Post Print Post  
I am having issues with xlookups when there is an ampersand involved.
I want to restrict the field so an ampersand can't be entered but the restriction in Property Editor does not do it, and On Element Exit programming does not do it.

I saw something about someone wanting to restrict the use of the F3 key, but cant find how to restrict a key stroke.

thanks
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: How to Avoid Ampersands being input
Reply #1 - Jan 23rd, 2012 at 3:18am
Print Post Print Post  
You could also solve it by 'escaping' the ampersand just before the XLU command.

Code
Select All
vStr = @Replace(vStr, "&", "\&") 



Or, you can change the value of the data upon element exit.

Code
Select All
vStr = @Replace(vStr, " & ", " and ")
vStr = @Replace(vStr, "&", " and ") 



If you still want to block that keystroke, you might want to look into the IgnoreKey() command.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged