K
K Dales
There are ways to do what you want, but they won't be
terribly easy since the part numbers do not have a
fixed "format" - i.e. some of them are #####A, some are
######A, some are ####-### and some are ####-###-#, etc.
Somehow you need to figure out how to convert these into
numerical order by stripping out any non-numeric
characters - and, at the same time (this could be
important) distinguishing between the different patterns
(for example, 1113-5 is not the same as 11135).
Here's how I would tackle it - can only give a quick
outline for now:
1) Develop a query with a calculated field that strips the
part numbers of any non-numeric characters and puts them
in the desired order (I'll call this query "ITEM SORT" and
the calculated field "SORTED PART NO")
2) Develop a second query based on the first one that
lists the same items in the same order, but also includes
a calculated field that shows the part number of the
previous item - you can do this with the DMax function;
i.e. in your column definition grid use the following
expression:
PREVIOUS PARTMax("[SORTED PART NO]","ITEM SORT","[SORTED
PART NO]<" & [SORTED PART NO]")
(this function finds the SORTED PART NO that is the
maximum value less than the value of the current record in
the new query).
3) Now use the test ([SORTED PART NO] - [PREVIOUS PART])>1
to determine if there is a gap in the numeric sequence.
Note: this query could take a long time to run if you have
many part numbers, since it needs to run a domain
aggregate function for each record. But it should be able
to do the job.
terribly easy since the part numbers do not have a
fixed "format" - i.e. some of them are #####A, some are
######A, some are ####-### and some are ####-###-#, etc.
Somehow you need to figure out how to convert these into
numerical order by stripping out any non-numeric
characters - and, at the same time (this could be
important) distinguishing between the different patterns
(for example, 1113-5 is not the same as 11135).
Here's how I would tackle it - can only give a quick
outline for now:
1) Develop a query with a calculated field that strips the
part numbers of any non-numeric characters and puts them
in the desired order (I'll call this query "ITEM SORT" and
the calculated field "SORTED PART NO")
2) Develop a second query based on the first one that
lists the same items in the same order, but also includes
a calculated field that shows the part number of the
previous item - you can do this with the DMax function;
i.e. in your column definition grid use the following
expression:
PREVIOUS PARTMax("[SORTED PART NO]","ITEM SORT","[SORTED
PART NO]<" & [SORTED PART NO]")
(this function finds the SORTED PART NO that is the
maximum value less than the value of the current record in
the new query).
3) Now use the test ([SORTED PART NO] - [PREVIOUS PART])>1
to determine if there is a gap in the numeric sequence.
Note: this query could take a long time to run if you have
many part numbers, since it needs to run a domain
aggregate function for each record. But it should be able
to do the job.