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

Limiting in queries

Status
Not open for further replies.

jaanisf

Technical User
Apr 30, 2003
50
LV
In MySQL:

SELECT something1,something2 from somebase WHERE this=that LIMIT 0,5 ORDER BY something1 DESC;

How can I limit query in Access queries? I need just the last 5 records to show, for example.

Thanks in advance!
 
With Access/Jet you can SELECT TOP x to retrieve the first x records of a dataset, but it doesn't support the LIMIT feature of MySQL (not a product I know a lot about unfortunately).

To retrieve only a certain number of records the easiest way is to use a recordset object in VBA and pick out the last 5 records (or any other number).

John
 
Well, you could maybe kindly tell me exactly, how can I do it in VBA, since I'm just a beginner in Access.
And.. the thing is - I have a subform, lets call it Sub1 in a form, for example Form1. Sub 1 is on tabular mode, and I want it to show me the last 5 records in following order: the latest record on top and the oldest below. I need it just because I use the Form1 to add new records, and sometimes I get disturbed in my work, so, when I come back, I want to see the latest records I've done, so that I could know without pressing any buttons where to continue my work. Hope you understand and can help ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top