|
-
Sep 14th, 2000, 04:25 PM
#1
Wondering if there is an algorithm out there that will tell you if a SSN is valid? I am writing a front-end to a user database and am having problems with false SSNs being entered for employees if the data entry person doesn't have it in front of them.
[Edited by tredfoot on 09-14-2000 at 05:34 PM]
-
Sep 14th, 2000, 07:23 PM
#2
Frenzied Member
I do not think so.
If the Social security Administration cannot help you, I do not think there is an algorithm.
I doubt that they will help. I suspect that the only way to validate is to have a database with all the numbers in it.
If you are working somewhere requiring W2 forms, Payroll withholding, et cetera, perhaps IRS or SSA would would verify on request or automatically when first government forms must be filed.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Oct 17th, 2000, 09:05 AM
#3
Addicted Member
SSN Varify Method
Hey, I use a varify code for my program to varify the SSN for a text box. You can specify the use of a seperator with this code as well. For Example: 999-99-9999 or 999999999. There are only 3 parts to this code and is not complicated. Here is the code:
Code:
Private Function SSNValidate(strSSN As String, _
Optional bolSeperator As Boolean) As String
Dim bolNotValid As Boolean
Dim intSeperator As Integer
Dim intLength As Integer
Dim strSeperator As String
'Determines the length the SSN should be.
If bolSeperator Then
intLength = 11
intSeperator = 1
strSeperator = "-"
Else 'Seperator specified
intLength = 9
End If
'Starts by checking the length of the value
If Len(strSSN) = intLength Then
'If the length is valid then it checks for valid
'characters inside the value
If IsNumeric(Left(strSSN, 3)) And _
IsNumeric(Mid(strSSN, 5, 2)) And _
IsNumeric(Right(strSSN, 4)) And _
Mid(strSSN, 4, intSeperator) = strSeperator And _
Mid(strSSN, 7, intSeperator) = strSeperator Then
SSNValidate = strSSN 'Stores value
Else
bolNotValid = True
End If
Else
bolNotValid = True
End If
'If the value is not correct a message is displayed and
'the return value is an empty string
If bolNotValid Then
MsgBox "The social security number is not valid. " & _
"If you don't specify a correct value, " & _
"the value will be deleted the next time this " & _
"record is updated.", vbInformation, "Invalid SSN"
SSNValidate = " - - " 'Return empty string for a
'masked edit control.
End If
End Function
If you find a more efficient way, please let me know. I hope this helps you out.
-
Oct 17th, 2000, 09:13 AM
#4
I don't think you can in the sense of making sure you have
a valid SSN. MIBEN's function will guarrantee that you
have the right pattern.
I KNOW that the last three digits are assigned sequentially
(as a matter of fact, you can use them to perform a random
selection from the SSN.......).
I have been told that the first 3 and middle 2 digits mean
something. Something about where in the country it was
issued, but I don't know what it is.
Good Luck
DerFarm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|