A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I limit the number of records in a query.



 
 
Thread Tools Display Modes
  #1  
Old August 31st, 2004, 03:57 PM
rnprice
external usenet poster
 
Posts: n/a
Default How do I limit the number of records in a query.

If I have a query that is combining information from two or more tables, one
of which has a date field, and I want to limit the query to the most current
20 records, how would I do this?
  #2  
Old August 31st, 2004, 04:15 PM
SteveS
external usenet poster
 
Posts: n/a
Default

In SQL view of the query, changing

Select

to

Select Top 20

will give you the the top 20 (or less) records. The date field must be
sorted in Desc order to get the most current records.

HTH
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)



"rnprice" wrote:

If I have a query that is combining information from two or more tables, one
of which has a date field, and I want to limit the query to the most current
20 records, how would I do this?

  #3  
Old August 31st, 2004, 04:27 PM
rnprice
external usenet poster
 
Posts: n/a
Default

Thank you. The query actually read "SELECT DISTINCTROW" so I had to replace
"DISTINCTROW" with "Top 20". It looks like it is working fine. Thanks again.

"SteveS" wrote:

In SQL view of the query, changing

Select

to

Select Top 20

will give you the the top 20 (or less) records. The date field must be
sorted in Desc order to get the most current records.

HTH
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)



"rnprice" wrote:

If I have a query that is combining information from two or more tables, one
of which has a date field, and I want to limit the query to the most current
20 records, how would I do this?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New records can't be seen rleblanc Using Forms 6 August 14th, 2004 02:43 PM
Use Combo box to limit records when subform is based on query? Steve C Using Forms 1 July 29th, 2004 04:35 AM
EXISTS reserved word in FROM clause Stephanie Doherty Running & Setting Up Queries 6 July 21st, 2004 01:15 AM
surely a form with a ListBox can be used in a query? 1.156 Running & Setting Up Queries 14 June 2nd, 2004 04:54 PM


All times are GMT +1. The time now is 08:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.