if you replace the second SQL query with one like this:

SELECT TOP 10 nonkeyfield, keyfield FROM tablename ORDER BY nonkeyfield


You will get the top 10 rows on non key field - even if keyfield is less than 10 unique values.

Now, the problem is that the column order is back to front from the earlier example as the TOP 10 keyword must precede the first row being selected or the SQL query engine chokes.
If the odd column order is not a problem, then you have a solution - two different queries.

However, if this is a problem, in that you'd like the column order to be the same for both queries then you have a problem.

One way around this is to use a "derived table" - something which I know SQL Server supports, and Access may well also.

A Derived table lets you 'create' a on-the fly table from a query and then query it with a second SQL statement, you can use this trick to run the query with the wrong column order(as above) then produce a query on this derived table to produce the right order of columns, and/or change the sort order of the columns.
An example of using a derived table using the above SQL would be:

select keyfield,nonkeyfield from
(SELECT TOP 10 nonkeyfield, keyfield FROM tablename ORDER BY nonkeyfield ) as Q1

(add optional order by statements here)


The Query in the brackets is the one I gave which gives the wrong order, you then make it a derived table by enclosing it in brackets '(' and ')' and adding the 'as Q1 ' I used the name Q1 as an arbitary name for this intermediate table, its never explicitly referenced, then prepending a 'select nonkeyfield,keyfield from' in front of the query.

Now I don't promise the Derived table idea will work on your Access/PHP system, but give it a go.
Also note that you could add a 'order by keyfield' at the end to get the table order back to keyfield order - except only the first 10 rows are ever returned even if using the keyfield order

Hope this helps.