@lmarconi,
I you can't change the legacy, or the company won't allow the contractor to change the legacy, then you have to modify your "compare code".
Here are a couple of routines that might help with logic. I did not check for 1 alpha and 1 numeric, but could be added if needed.
Code:
' ----------------------------------------------------------------
' Procedure Name: ValidateIt
' Purpose: Routine to do basic checks on an expected 2 character input value
' Procedure Kind: Sub
' Procedure Access: Public
' Author: Jack
' Date: 25-Jun-21
' ----------------------------------------------------------------
Sub ValidateIt()
Dim i As Integer
Dim x(4) As String
x(0) = "m2 "
x(1) = "2m"
x(2) = "m2"
x(3) = "m24"
x(4) = ""
For i = 0 To UBound(x)
If Len(x(i)) > 2 Then 'original input too long
Debug.Print "original value <" & x(i) & "> too long"
ElseIf Len(Trim(x(i))) = 2 Then 'had leading/trailing space(s)
Debug.Print "original value <" & x(i) & "> had leading otr trailing space(s)"
ElseIf Len(x(i)) = 0 Then 'no value supplied
Debug.Print "original value <" & x(i) & "> was Null/empty"
End If
Next i
End Sub
Code:
' ----------------------------------------------------------------
' Procedure Name: getReverse
' Purpose: To interchange the 2 characters of input
' Procedure Kind: Function
' Procedure Access: Public
' Parameter x (String): 2 char string to be reversed
' Return Type: String
' Author: Jack
' Date: 25-Jun-21
' ----------------------------------------------------------------
Function getReverse(x As String) As String
If Len(x) = 2 Then
getReverse = Mid(x, 2, 1) & Mid(x, 1, 1)
Else
getReverse = "Error"
End If
End Function
You can compare the value supplied or the reverse of the value supplied.