Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Open form to show only last 10 records

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
SteveL13
Asked:
SteveL13
  • 2
1 Solution
 
Robert ShermanOwnerCommented:
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
 
Robert ShermanOwnerCommented:
..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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now