Solved

Open form to show only last 10 records

Posted on 2014-12-22
2
158 Views
Last Modified: 2014-12-22
I have a form (datasheet) that is bound to a table.  But when the form opens I only want the last 10 records to display.

How can this be done?
0
Comment
Question by:SteveL13
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
Robert Sherman earned 500 total points
Comment Utility
If you have an autoincrementing ID field, you can probably use TOP

SELECT TOP 10 FROM table ORDER BY ID DESC;

This would, of course, give the last 10 records in reverse order.  You could then use that as a subquery to re-order them, but I believe you might be able to do the re-ordering in a form property.

SELECT * FROM (SELECT TOP 10 FROM table ORDER BY ID DESC;) ORDER BY ID;
0
 
LVL 7

Expert Comment

by:Robert Sherman
Comment Utility
..and since you mentioned that the form is bound to the table directly, you would just change the datasource of that form to the SQL query.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now