تشکر ویژه ، خیلی ممنونماز لطف شما
یه سوال دیگه هم در مورد سورس تشخیص کد ملی دارم

یه دستور خودم نوشتم ولی درست کارنمیکنه و همچنین میخام تو هر فرمی و هر تکستی در قسمت ValidationRule گذاشتم فعال بشه و نیاز به همون فرم نداشته باشه

Function Sshmelli(shmelli As Variant) As Boolean
On Error GoTo Err_Sshmelli
Dim a, b, c, d As Integer
a = Right(Form_T_personel.shmelli.Value, 1)
b = (Mid(shmelli, 1, 1) * 10) + (Mid(shmelli, 2, 1) * 9) + (Mid(shmelli, 3, 1) * 8) + (Mid(shmelli, 4, 1) * 7) + (Mid(shmelli, 5, 1) * 6) + (Mid(shmelli, 6, 1) * 5) + (Mid(shmelli, 7, 1) * 4) + (Mid(shmelli, 8, 1) * 3) + (Mid(shmelli, 9, 1) * 2)
c = b - Int(b / 11) * 11
d = (11 - c)

If c = 0 And c = a Then
If c = 1 And c = a Then
If c >= 2 And d = a Then
Else
Sshmelli = False
End If
Else
Sshmelli = False
End If
Else
Sshmelli = False
End If

Sshmelli = True
Exit_Sshmelli:
On Error Resume Next
Exit Function
Err_Sshmelli:
Select Case Err.Number
Case 0
Resume Exit_Sshmelli:
Case 94
Sshmelli = True
Case Else
MsgBox Err.Number & " " & Err.Description, vbExclamation, "Error in module Module2 - function Sshmelli"
Resume Exit_Sshmelli:
End Select

End Function