TopValues Property Example

The following example assigns an SQL string that returns the top 10 most expensive products to the RecordSource property for a form that will display the ten most expensive products.

Dim strGetSQL As String
strGetSQL = "SELECT TOP 10 Products.[ProductName] " _
    & "AS TenMostExpensiveProducts, Products.UnitPrice FROM Products " _
    & "ORDER BY Products.[UnitPrice] DESC;"
Me.RecordSource = strGetSQL