YasserKhalil
Well-known Member
- Joined
- Jun 24, 2010
- Messages
- 852
Hi everybody
I've written the following function to extract two digits from a 14 digits and then use these two digits to return a string value
But it doesn't work as I expect
I want to fix it
I've written the following function to extract two digits from a 14 digits and then use these two digits to return a string value
But it doesn't work as I expect
Code:
Function Governorate(strID As Variant) As String
Dim strGov As String
If Len(strID) = 14 Then
strGov = Mid(strID, 8, 2)
If strGov = "33" Then
Governorate = "Sector1"
ElseIf strGov = "02" Then
Governorate = "Sector2"
Else
GoTo Err
End If
End If
Err:
Governorate = ""
End Function
I want to fix it