After suggesting to the interface coders and the dba that they fall back to their real careers, and buying them their first bottle of MD20/20 to get then started, you'll probably need to use numerous checks for sanity, here I added a check for spaces:
I'd further wrap LB's
stringvar MyPhone:= replace(replace(replace({@phone}," ",""),"-",""),"/","");
// Then do some sanity checking:
if len(trim(MyPhone)) = 10 then
picture(MyPhone,"(xxx)-xxx-xxxx")
else
"*"&picture(MyPhone,"(xxx)-xxx-xxxx")
The second adding an asterisk to identify bad numbers.
There are plenty of other checks done to bad phone numbers, but the point is to correct the front end, adn issue a update/replace against the database to fix the problem permanently.
-k