Putting these two functions in a standard module and invoking the EncriptSSN Function from the BeforeUpdate event of your form should be a lot easier and *much* easier to maintain later on.
Code:
Public Function EncriptSSN(strIn As String) As String
'-- Encript the incoming SSN value
Dim Marker As Long
If Len(strIn & "") > 0 Then
For Marker = 1 To Len(strIn)
EncriptSSN = EncriptSSN & EncriptIt(Mid(strIn, Marker, 1))
Next Marker
Else
'-- Do not attempt any conversion
MsgBox "Invalid entry for 'EncriptSSN' ", vbExclamation + vbOKOnly
End If
End Function
Public Function EncriptIt(InChr As String) As String
'-- Encript the incoming character to the following spec
'1=A, 2=B, 3=C, 4=3, 5=S, 6=8, 7=Z, 8=X, 9=U, 0=G, "-" = J
Select Case InChr
Case "1"
EncriptIt = "A"
Case "2"
EncriptIt = "B"
Case "3"
EncriptIt = "C"
Case "4"
EncriptIt = "3"
Case "5"
EncriptIt = "S"
Case "6"
EncriptIt = "8"
Case "7"
EncriptIt = "Z"
Case "8"
EncriptIt = "X"
Case "9"
EncriptIt = "U"
Case "0"
EncriptIt = "G"
Case "-"
EncriptIt = "J"
Case Else
EncriptIt = "" '-- Strip this character
End Select
End Function