L
LeslieJ via AccessMonster.com
My database contains an "inventory" of controlled documents and all their
past and current versions.
I have a query that searches for all the archived documents, and it shows all
of the archived versions related to that document.
For example: Doc # 01 234 V01, Doc #01 234 V02 etc.
The version field is a text field, because each document type has a different
version format (a Head Office idea, not my own).
In this query that searches for all the archived documents, I would like to
only see the last archived version, meaning the highest version in the query
for that document. I have realized that the Group By Max option does not
work because this is a text field, and have not been able to figure out
anything that works with text. Any help would be greatly appreciated!
The following is the SQL for the query: (Note: this query is a parameter
query, that gets the Document Type from a form so as to filter the query,
otherwise it would be just too big.)
SELECT [Documents Info 1].[Documents Id] AS [Document ID], [Documents Info 1].
Identifier AS [Version Identifier], [Documents Info 1].[Document Revision] AS
[Document Revision], [Documents Info 1].Amendment AS [Document Amendment],
[Documents Info 1].[Document Name], [Documents Info 1].Status AS [Document
Status Type], [Documents Info 1].[Date Received], [Documents Info 1].[Date
Issue] AS [Date of Initial Issue], [Documents Info 1].[Effective Date],
[Documents Info 1].Comments, [Documents Info 1].[Head Office DC No] AS [HO
Document Number], [Documents Info 1].[Date Archived], [Documents Info 1].
[Reason Archived]
FROM [Document Type] INNER JOIN ((Documents INNER JOIN [Document Appendiums]
ON Documents.Identifier = [Document Appendiums].Reference) INNER JOIN
[Documents Info 1] ON [Document Appendiums].Identifier = [Documents Info 1].
[Documents Id]) ON [Document Type].Identifier = Documents.[Document Type]
WHERE ((([Documents Info 1].Status)=2) AND (([Documents Info 1].[Date
Archived]) Between #1/1/2006# And #12/31/2008#) AND (([Document Type].
[Document Type])=[Forms]![Transfer Queries]![txtType]))
ORDER BY [Documents Info 1].[Documents Id], [Documents Info 1].[Document
Revision] DESC;
past and current versions.
I have a query that searches for all the archived documents, and it shows all
of the archived versions related to that document.
For example: Doc # 01 234 V01, Doc #01 234 V02 etc.
The version field is a text field, because each document type has a different
version format (a Head Office idea, not my own).
In this query that searches for all the archived documents, I would like to
only see the last archived version, meaning the highest version in the query
for that document. I have realized that the Group By Max option does not
work because this is a text field, and have not been able to figure out
anything that works with text. Any help would be greatly appreciated!
The following is the SQL for the query: (Note: this query is a parameter
query, that gets the Document Type from a form so as to filter the query,
otherwise it would be just too big.)
SELECT [Documents Info 1].[Documents Id] AS [Document ID], [Documents Info 1].
Identifier AS [Version Identifier], [Documents Info 1].[Document Revision] AS
[Document Revision], [Documents Info 1].Amendment AS [Document Amendment],
[Documents Info 1].[Document Name], [Documents Info 1].Status AS [Document
Status Type], [Documents Info 1].[Date Received], [Documents Info 1].[Date
Issue] AS [Date of Initial Issue], [Documents Info 1].[Effective Date],
[Documents Info 1].Comments, [Documents Info 1].[Head Office DC No] AS [HO
Document Number], [Documents Info 1].[Date Archived], [Documents Info 1].
[Reason Archived]
FROM [Document Type] INNER JOIN ((Documents INNER JOIN [Document Appendiums]
ON Documents.Identifier = [Document Appendiums].Reference) INNER JOIN
[Documents Info 1] ON [Document Appendiums].Identifier = [Documents Info 1].
[Documents Id]) ON [Document Type].Identifier = Documents.[Document Type]
WHERE ((([Documents Info 1].Status)=2) AND (([Documents Info 1].[Date
Archived]) Between #1/1/2006# And #12/31/2008#) AND (([Document Type].
[Document Type])=[Forms]![Transfer Queries]![txtType]))
ORDER BY [Documents Info 1].[Documents Id], [Documents Info 1].[Document
Revision] DESC;