Access - digitos bancarios

 
Vista:

digitos bancarios

Publicado por raul (5 intervenciones) el 21/02/2006 10:24:18
Una cuenta bancaria tiene 20 digitos. Tengo una formula en excel que permite calcular si los 20 digitos son correctos pero no se como hacerlo en access. Si alguien tiene una manera de hacerlo agradeceria me lo envien o me lo expliquen.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:digitos bancarios

Publicado por 2pl (773 intervenciones) el 21/02/2006 14:01:18
AHI TIENES ESTA FUNCION:
Function sBankControlDigit(Bank As Variant, SubBank As Variant, Account As Variant) As String

Dim sBank As String
Dim sSubBank As String
Dim sAccount As String
Dim Cuenta As String
Dim Temporal As Integer
Dim i As Integer

sBank = Format(Bank, "0000")
sSubBank = Format(SubBank, "0000")
sAccount = Format(Account, "0000000000")

If IsNull(Account) Then
Else
For i = 1 To 10
If Mid(Account, i, 1) = "." Then
sBankControlDigit = "**"
Exit Function
End If
Next
Cuenta = sAccount
End If

On Error GoTo ControlErrores

Temporal = 0
Temporal = Temporal + Mid(sBank, 1, 1) * 4
Temporal = Temporal + Mid(sBank, 2, 1) * 8
Temporal = Temporal + Mid(sBank, 3, 1) * 5
Temporal = Temporal + Mid(sBank, 4, 1) * 10
Temporal = Temporal + Mid(sSubBank, 1, 1) * 9
Temporal = Temporal + Mid(sSubBank, 2, 1) * 7
Temporal = Temporal + Mid(sSubBank, 3, 1) * 3
Temporal = Temporal + Mid(sSubBank, 4, 1) * 6
Temporal = 11 - (Temporal Mod 11)

If Temporal = 11 Then
sBankControlDigit = "0"
ElseIf Temporal = 10 Then
sBankControlDigit = "1"
Else
sBankControlDigit = Format(Temporal, "0")
End If

Temporal = 0
Temporal = Temporal + Mid(sAccount, 1, 1) * 1
Temporal = Temporal + Mid(sAccount, 2, 1) * 2
Temporal = Temporal + Mid(sAccount, 3, 1) * 4
Temporal = Temporal + Mid(sAccount, 4, 1) * 8
Temporal = Temporal + Mid(sAccount, 5, 1) * 5
Temporal = Temporal + Mid(sAccount, 6, 1) * 10
Temporal = Temporal + Mid(sAccount, 7, 1) * 9
Temporal = Temporal + Mid(sAccount, 8, 1) * 7
Temporal = Temporal + Mid(sAccount, 9, 1) * 3
Temporal = Temporal + Mid(sAccount, 10, 1) * 6
Temporal = 11 - (Temporal Mod 11)

If Temporal = 11 Then
sBankControlDigit = sBankControlDigit + "0"
ElseIf Temporal = 10 Then
sBankControlDigit = sBankControlDigit + "1"
Else
sBankControlDigit = sBankControlDigit + Format(Temporal, "0")
End If

If Len(Trim(Cuenta)) < 10 Then
sBankControlDigit = "**"
Exit Function
End If

For i = 1 To 10
If Mid(Cuenta, i, 1) = "-" Or Mid(Cuenta, i, 1) = "." Then
sBankControlDigit = "**"
Exit Function
End If
Next

Exit Function
ControlErrores:
sBankControlDigit = "**"

End Function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:digitos bancarios

Publicado por raul (5 intervenciones) el 21/02/2006 17:47:39
ok Gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar