derykm@oz.plymouth.edu (Dez) (06/20/91)
What I would like to do is make sure a user either inputs 9 digits for a social security number or if there is a routine that if the user does enter the leading zeros, the program will trim off the zeros. In the program it will be used as a validation procedure. This way person 003-45-7899 is identical to 3-45-7899. thanks Deryk
aindiana@osiris.cso.uiuc.edu (Daiv Stoner) (06/21/91)
derykm@oz.plymouth.edu (Dez) writes: >What I would like to do is make sure a user either inputs 9 digits for a >social security number or if there is a routine that if the user does >enter the leading zeros, the program will trim off the zeros. >In the program it will be used as a validation procedure. >This way person 003-45-7899 is identical to 3-45-7899. >thanks >Deryk Ahhh, yes. Those pesky SSNs that begin with zero(s). I ran into that problem a while back. Here's how I dealt with it in FoxPro: Make the SSN field a character field of 9 characters. Whenever you use GET to read in the SSN, use a picture clause to put in the dashes, like so: @10,10 get SSN picture "@R 999-99-9999" valid v_ssn Then, in the v_ssn function, check the length of the SSN string. Also, check for blanks. If there are blanks, you have a choice of how you can code it. You can either reject it as bad input, or you can replace the blanks with zeros. I spent a lot of time trying to work out this solution, and this is the best thing I've come up with. I'd be happy to hear feedback from others about this. Daiv -- Daiv Stoner aindiana@osiris.cso.uiuc.edu daiv@coplex.UUCP