obiku
Gebruiker
- Lid geworden
- 25 jul 2004
- Berichten
- 60
All, zie onderstaande functies
Wanneer ik in een formulier deze funtie's aanspreek geeft alleen de fValidRef functie continu een Error 94
Als ik via
tekst controleer wordt de if then netjes afgewerkt.
bij
Krijg ik de error 94 te zien???
Dit terwijl de funtie wel eem False of TRUE terug geeft..
Waar kijk ik over heen....
Code:
Public Function fValidAWB(ByVal AWB As String) As Boolean
On Error GoTo Err_Handler
Dim strValAWB
'Check if AWB contains only 11 digits
'If Not IsNull(AWB) And AWB <> "" And Len(AWB) = 11 And IsNumeric(AWB) Then
If Not IsNull(AWB) And AWB <> "" And my_regexp(AWB, "\b\d{11}\b") = True Then
'Validate AWB
strValAWB = Left(AWB, 10) & CStr(CLng(Mid(AWB, 4, 7)) Mod 7)
If AWB = strValAWB Then
fValidAWB = True
Exit Function
End If
End If
Exit_Handler:
fValidAWB = False
Exit Function
Err_Handler:
Resume Exit_Handler
End Function
Public Function fValidHWB(ByVal HWB As String) As Boolean
On Error GoTo Err_Handler
Dim strValHWB
'Check if HWB contains only 9 digits and 1 Alphanumeric Character which only can be an T
If Not IsNull(HWB) And HWB <> "" And my_regexp(HWB, "\b\d{9}[0-9tT]\b") = True Then
'Validate HWB
Select Case CLng(Left(HWB, 9)) Mod 11
Case 0 To 9
strValHWB = Left(HWB, 9) & CStr(CLng(Left(HWB, 9)) Mod 11)
Case 10
strValHWB = Left(HWB, 9) & "T"
End Select
If HWB = strValHWB Then
fValidHWB = True
Exit Function
End If
End If
Exit_Handler:
fValidHWB = False
Exit Function
Err_Handler:
Resume Exit_Handler
End Function
Public Function fValidPalletID(ByVal PalletID As String) As Boolean
On Error GoTo Err_Handler
Dim strValPalletID
'Check if PalletID starts with a Character followed by 9 digits
If Not IsNull(PalletID) And PalletID <> "" And my_regexp(PalletID, "\b[a-zA-Z]{1}\d{9}\b") = True Then
fValidPalletID = True
Exit Function
End If
Exit_Handler:
fValidPalletID = False
Exit Function
Err_Handler:
Resume Exit_Handler
End Function
Public Function fValidREF(ByVal REF As String) As Boolean
On Error GoTo Err_Handler
'Check if REF is NOT a AWB, HWB or PalletID
If Not IsNull(REF) And REF <> "" And fValidHWB(REF) = False And fValidAWB(REF) = False And fValidPalletID(REF) = False Then
fValidREF = True
Exit Function
End If
Exit_Handler:
fValidREF = False
Exit Function
Err_Handler:
Resume Exit_Handler
End Function
Als ik via
Code:
If fValidAWB("Tekst") = false then
If fValidHWB("Tekst") = false then
of
If fValidPalletID("Tekst") = false then
bij
Code:
If fValidREF("Tekst") = false then
Dit terwijl de funtie wel eem False of TRUE terug geeft..
Waar kijk ik over heen....