Voila un code il sert à controler un siret
ptiville1
Messages postés
30
Statut
Membre
-
acrombez Messages postés 62 Statut Membre -
acrombez Messages postés 62 Statut Membre -
Bonjour,
voila un code trouvé sur le web, il sert à controler un n° de siret
je cherche à l integrer à un formulaire d' nscription mais je galere
si une ame charitable peut m aider
voici le code
Public Function Siren_IsValid(ByVal pvValue As Variant) As Boolean
Dim i As Integer
Dim v As Integer
Dim iLuhnKey As Integer
Siren_IsValid = False
If Not IsNumeric(pvValue) Then Exit Function
If Len(Format$(CDbl(pvValue), "000000000")) <> 9 Then Exit Function
If pvValue = "000000000" Then Exit Function
iLuhnKey = 0
For i = 1 To Len(pvValue)
v = CInt(Mid$(pvValue, i, 1))
'*** Siren : les chiffres PAIRS pour le Siren sont doublés
If (i Mod 2) = 0 Then
v = v * 2
End If
If v >= 10 Then
iLuhnKey = iLuhnKey + (v - 9)
Else
iLuhnKey = iLuhnKey + v
End If
Next i
Siren_IsValid = (iLuhnKey Mod 10 = 0)
End Function
Public Function Siret_IsValid(ByVal pvValue As Variant) As Boolean
Dim i As Integer
Dim v As Integer
Dim iLuhnKey As Integer
Siret_IsValid = False
If Not IsNumeric(pvValue) Then Exit Function
If Len(Format$(CDbl(pvValue), "00000000000000")) <> 14 Then Exit Function
If pvValue = "00000000000000" Then Exit Function
If Not Siren_IsValid(Left$(pvValue, 9)) Then Exit Function
iLuhnKey = 0
For i = 1 To Len(pvValue)
v = CInt(Mid$(pvValue, i, 1))
'*** Siret : les chiffres IMPAIRS sont doublés
If (i Mod 2) = 1 Then
v = v * 2
End If
If v >= 10 Then
iLuhnKey = iLuhnKey + (v - 9)
Else
iLuhnKey = iLuhnKey + v
End If
Next i
Siret_IsValid = (iLuhnKey Mod 10 = 0)
End Function
voila un code trouvé sur le web, il sert à controler un n° de siret
je cherche à l integrer à un formulaire d' nscription mais je galere
si une ame charitable peut m aider
voici le code
Public Function Siren_IsValid(ByVal pvValue As Variant) As Boolean
Dim i As Integer
Dim v As Integer
Dim iLuhnKey As Integer
Siren_IsValid = False
If Not IsNumeric(pvValue) Then Exit Function
If Len(Format$(CDbl(pvValue), "000000000")) <> 9 Then Exit Function
If pvValue = "000000000" Then Exit Function
iLuhnKey = 0
For i = 1 To Len(pvValue)
v = CInt(Mid$(pvValue, i, 1))
'*** Siren : les chiffres PAIRS pour le Siren sont doublés
If (i Mod 2) = 0 Then
v = v * 2
End If
If v >= 10 Then
iLuhnKey = iLuhnKey + (v - 9)
Else
iLuhnKey = iLuhnKey + v
End If
Next i
Siren_IsValid = (iLuhnKey Mod 10 = 0)
End Function
Public Function Siret_IsValid(ByVal pvValue As Variant) As Boolean
Dim i As Integer
Dim v As Integer
Dim iLuhnKey As Integer
Siret_IsValid = False
If Not IsNumeric(pvValue) Then Exit Function
If Len(Format$(CDbl(pvValue), "00000000000000")) <> 14 Then Exit Function
If pvValue = "00000000000000" Then Exit Function
If Not Siren_IsValid(Left$(pvValue, 9)) Then Exit Function
iLuhnKey = 0
For i = 1 To Len(pvValue)
v = CInt(Mid$(pvValue, i, 1))
'*** Siret : les chiffres IMPAIRS sont doublés
If (i Mod 2) = 1 Then
v = v * 2
End If
If v >= 10 Then
iLuhnKey = iLuhnKey + (v - 9)
Else
iLuhnKey = iLuhnKey + v
End If
Next i
Siret_IsValid = (iLuhnKey Mod 10 = 0)
End Function
A voir également:
- Voila un code il sert à controler un siret
- Code ascii - Guide
- Comment déverrouiller un téléphone quand on a oublié le code - Guide
- Code puk bloqué - Guide
- Code activation windows 10 - Guide
- Scanner un qr code sur pc - Guide