Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query select last 15 records (Access 2003)

    Can someone be good enough to show me how I can reduce the number of records the listbox fills with. I am trying to make it show the last 15 records, in ID2 order. 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;

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Query select last 15 records (Access 2003)

    Use SELECT TOP as follows:

    SELECT TOP 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;

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query select last 15 records (Access 2003)

    Many thanks Pat, easy when you know how?. Have a good Easter, thanks again.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Query select last 15 records (Access 2003)

    Shouldn't that be

    SELECT TOP 15 ...

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Query select last 15 records (Access 2003)

    Yes indeed it should.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •