Jake, that's really messy data, particularly with the alpha characters,
Roman numerals, brackets, et al.
The function below illustrates how to sort with numeric data of this kind.
If the field is named ID, you would end up with a query that ends:
ORDER BY PointSort([ID])
But in your case, you will need to use Replace to convert the opening
brackets to periods and to drop the closing brackets, convert the
alpha/roman to real numbers before you pass the string into the
PointSort() function. The function also assumes no points larger than
9999.
HTH.
Public Function PointSort(varInput As Variant, Optional strDelim As String
= ".") As Variant
'Purpose: Sort on a field such as "5.11.2"
Dim strOut As String
Dim i As Integer
Dim varArray As Variant
PointSort = Null 'Initialize to null
If Not (IsError(varInput) Or strDelim = vbNullString) Then
If Not IsNull(varInput) Then
varArray = Split(varInput, strDelim)
For i = LBound(varArray) To UBound(varArray)
strOut = strOut & Format(varArray(i), "0000")
Next
If strOut <> vbNullString Then
PointSort = strOut
End If
End If
End If
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Jake said:
Sorry, I wasn't clear; the field contains values such as 9.1001(a),
9.101(a) which sort 9.1001 before 9.101.
Jake