The CLng function converts a string to a long integer value, insuring that
you get a numberic sort from your numbers. The Right(Value, Number of
Characters) takes a text value and extracts from the right side the number of
stated characters. For example, Right(AA1222,4) would return the value of
1222. The Len(Value) function counts the number of characters in a value and
returns that number. For example, Len(123) would return a 3.
The formula uses a combination of these formulas to arrive at the result.
So in this instance, Clng(Right([PartNumber]),Len([PartNumber])-2) does the
following:
The Clng function converts the result to a long integer, the right function
extracts all the characters from the 3rd position to the end, the number of
characters to be extracted determined by the total length of the value - the
2 character positions occupied by the part number prefix letters.
Hope this helps.
--
Kevin Backmann
Dustin said:
Hi Kevin,
I am self-learning access, so I know what you want me to do. But what do
some of those characters in the Expression mean? Ex. CLng, Right, Len, and
-2. That way I understand how it worked. I hope I am not asking too much.
Thanks,
Dustin B
Kevin B said:
Create a query, select the columns you want regturned and in a blank column
enter the the following formula, replacing [FieldName] with the name of the
alpanumeric field you want to sort by:
CLng(Right([FieldName],Len([FieldName])-2))
Set the sort to Ascending or Descending, depending upon your wont, and turn
off the display check box to suprress the display of your sort column
--
Kevin Backmann
:
I have some part numbers that are unique only through letters not numbers.
The two differences are DR and DF and then the numbers. Ex. DR1240,DF1240.
How do I get them to sort numerically?