Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating a bank sort code

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
I have a bank sort code, presently stored as 6 digits, so ‘123456’, stored in a Supplier table. For data entry, I would like to display this as 12-34-56, with the control source linking to the supplier table, so that if the user wants to edit it, he keys in (say) the characters 6 0 1 0 1 3 , and this would appear on the screen as 60-10-13.

During input the hyphen characters should be protected from input, so that they never individually receive focus; when the form is saved the value ‘601013’ should be saved.

I have tried setting the input mask for the control to ’99-99-99’. This however causes the original sort code from the supplier table to be displayed as 60-34- This is not what I want.

How should the form present the sort code for editing? Or do I need to store the sort code on the supplier file as the expanded ‘60-10-13.’

Thanks.
 
Andrew,

As well as setting the InputMask to 99-99-99, you need to set the Format property to R.

This will cause the user to see the hyphens, but without being able to edit them (the cursor will jump over them). The hyphens will not be stored in the underlying table.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes, as in TRANSFORM('601013','@R 99-99-99') vs TRANSFORM('601013','99-99-99')
It only works with Format R.

Bye, Olaf.
 
Thank you both. That works well - a great improvement. Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top