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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query for only the three most recent date entries 2

Status
Not open for further replies.

GordonV

Technical User
May 2, 2000
14
US
I am having great difficulty narrowing a query to locate only the three most recent dates entries for a particular record.<br><br>The database is set up as a main table with a unique record number, then a second table with several date style entries which relate to the first table.&nbsp;&nbsp;<br><br>I have been able to retrieve events for the past thirty days but I really only want to show the three most recent.<br><br>Any thoughts,<br><br>Thanks<br><br>Gordon
 
An easy way to do this on a <i>form</i> is to use a listbox or combobox with the underlying query sortying in reverse chronological order. Then set the control's ListRows property to 3. It will display the top three but the user can scroll down for the rest.
 
First write your select query to sort descending on the date field.&nbsp;&nbsp;Then go to Query Properties. (You can get there using the View/Properies menu or by right clicking on the background of the QBE window where the tables sit.) The third field down from the top is Top Values.&nbsp;&nbsp;It has a drop down list but will allow you to type in 3 to select the first three items.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top