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

Limit record returns from data base 2

Status
Not open for further replies.

DK47

Programmer
Jun 3, 2003
118
US
Hey All,
Using Jet4 with an Access database, would it be possible to limit the number of records returned, using the RecordCount Property in an SQL statement?
For example, if an SQL query called for values associated with dates, could it be written to return just 5 or 10 records?

Thanks in advance.
Dwight

 

Access 2002, SQL Server can use TOP n in the select ..

SELECT TOP 5 <column1>, ... from


Mark

&quot;You guys pair up in groups of three, then line up in a circle.&quot;
- Bill Peterson, a Florida State football coach
 
SELECT TOP 5 * FROM database

The top 5 indicator would mean to take the top 5 records
that matched the criteria.

Swi
 
Thanks Guys,
That will do the trick.
Have a great day.
Dwight
 
Mark and Swi,
An additional question on this, if you don't mind.

How would I get the last 10 records from the table, instead of the first 10.

I tried to use the ASC and DESC keywords but this only succeeded in rearranging the order of the first 10 and did not call the last entries in the table.

Thanks,
Dwight

 

[tt]
Select Top 10 From Table Where Criteria = input Order By Unique ID Autonumber desc
[/tt]

Or something like that...

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top