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 The Numer Of Records Retrieved

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi

I wish to limit the number of records retrieved from a table. I am only retrieving one column from the table, and it is not unique, but I only want the first 10 values. I have tried the following, but Access does not appreciate it:-

Set rstThread = dbsExperiment.OpenRecordset("select top 10 distinct(id_field) from table order by id_field desc;", dbOpenForwardOnly)

I canl happily retrieve the distinct field values, or the top 10 field values, but not the top 10 distinct values. Is it possible?

All the best

Keith
 
Keith,

Have you considered making it a two step process? First retrieve the distinct values, then build a second query from the first pulling out the top 10 values?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top