1 of 1 people found this helpful
I have this set up for a Sort Code field, we type 123456 into the field and it's formatted at 12-34-56
It's self explanatory and easy to amend for phone numbers, credit card numbers etc.
Add a 'Text' field to your table and call it SortCode or whatever you prefer. Double click the field or hit the "Options" button.
On the "Auto-Enter" tab, click the "Calculated value" check box then copy and paste the text shown below:
Let ( digits = Filter ( Self ; "0123456789" ) ; /*excludes all other characters*/
( Length ( digits ) = 6 ; Left ( digits ; 2 ) & "-" & Middle ( digits ; 3 ; 2 ) & "-" & Right ( digits ; 2 )
/* sort code */ ;
Self /* error, don't modify user input */
) /* ends case */
) /* ends let */
Yes, MS Access made this task very simple and there are one or two other things that FM should have as standard but the trade off is definitely worth it...
Thanks for the advice - I'll give this a whirl