I am trying to sort a list of alphanumeric ID's in numeric order using the OrderBy property of a table. They are in the format of 2 letters followed by numbers. Like this "AA10199"
However the number is not an autonumber part, it is entered by users. Sometimes these users put too many letters in, like this "AAa10199" so my original sort for the table fails.
This was
Sorted ascending.
But with extra letters added an error is returned and the sort fails, so I thought this may work.
It doesn't, it just produces an #Error value and will not sort. It fails with IsError as well. What am I doing wrong?
However the number is not an autonumber part, it is entered by users. Sometimes these users put too many letters in, like this "AAa10199" so my original sort for the table fails.
This was
Code:
cint(mid([ar_id],3,8))
But with extra letters added an error is returned and the sort fails, so I thought this may work.
Code:
IIf((IsNumeric(CInt(Mid([ar_id],3,8)))),CInt(Mid([ar_id],3,8)),0)
Comment