Solved

Open form to show only last 10 records

Posted on 2014-12-22
2
161 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
ID: 40512935
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
ID: 40512943
..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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

776 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