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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Federal Tax ID:

Status
Not open for further replies.

FoxLearner

Programmer
Aug 29, 2002
93
US
Hi
Did any of you do validations for a Federal Tax Id? If so can I use/see the code for the validation?

Thnaks and Regards
FoxLearner
 
From your question on how to validate, I'd guess you also store the hyphens as well in your fields. Here is the format difference between SSN and TIN, note that both are composed of 9 numbers:

123-456-789 - Social Security number
12-3456789 - Federal Tax ID number

Try this, and use whichever case tests you decide you need, or adjust as needed:

Code:
tin="12-3456789"
do case
case len(tin)<>10  && use this if you require all 10 chars
   ? &quot;Incorrect length for valid TIN (nn-nnnnnnn)&quot;
case len(tin)=10 and substr(tin,3,1)<>&quot;-&quot;
   ? &quot;Format incorrect for valid TIN (nn-nnnnnnn)&quot; 
case len(chrtran(tin,&quot;-&quot;,&quot;&quot;))<>9
   ? &quot;Incorrect length for valid TIN (9 numbers)&quot; 
case chrtran(tin,&quot;-&quot;,&quot;&quot;)<>padl(ltrim(str(val(chrtran(tin,&quot;-&quot;,&quot;&quot;)),9,0)),9,&quot;0&quot;)
   ? &quot;Nine numbers required for valid TIN&quot; 
endcase
 
In general, SSN and credit card numbers uses a scheme to ensure valid numbers are given. Credit card uses Modulo10 approach to determine what the last digit will be. (The first 15 digits determine the value of the last one). I suspect the same applies to FTN.


Jean
 
This SSA page has a few links to help employers determine whether a Social Security Number may be valid or invalid is found here. The short answer is that numbers beginning with 000 will always be invalid and as of this month (August 2003) they have not issued any 3-digit beginning numbers higher than 772.


To be absolutely sure of a SSN's validity, the employer would have to submit names and numbers to the SSA, but there are rules and guidelines on how the employer prepares and submits his list. You know, to avoid possible discrimination, etc.

I don't know about confirming employer IDs, either state or federal. I do know that the federal numbers have 2 digits, a dash and then the rest of the number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top