Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select last 15 records 2

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
The code below is the record source of a listbox. How do I modify the code so that it shows only the last 15 records
in ID2 order. Many thanks

SELECT TXMASTERS.ID1, TXCLIPS.ID2, " " AS Persons, TXCLIPS.NName AS Name, TXCLIPS.Comments, TXCLIPS.Start AS [Time In], TXCLIPS.End AS [Time Out], TXCLIPS.ID1
FROM TXMASTERS INNER JOIN TXCLIPS ON TXMASTERS.ID1 = TXCLIPS.ID1
WHERE (((TXCLIPS.ID1)=[FORMS]![Mainform1].[FORM].[ID1]))
ORDER BY TXCLIPS.ID2 DESC;
 
Many thanks, however its the last 15 records I am trying to get? Thanks
 
hi

Do you need the last 15 records ordered by TXCLIPS.ID2 DESC?
If so, then order it by ASC then get the top 15.

SELECT *
FROM
(
SELECT TOP 15 TXMASTERS.ID1, TXCLIPS.ID2, " " AS Persons, TXCLIPS.NName AS Name, TXCLIPS.Comments, TXCLIPS.Start AS [Time In], TXCLIPS.End AS [Time Out], TXCLIPS.ID1
FROM TXMASTERS INNER JOIN TXCLIPS ON TXMASTERS.ID1 = TXCLIPS.ID1
WHERE (((TXCLIPS.ID1)=[FORMS]![Mainform1].[FORM].[ID1]))
ORDER BY TXCLIPS.ID2 ASC
) T
ORDER BY ID2 DESC
 
Mnay thanks, that sorted that out. Have a good Easter, regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top