Paulo Silva
Paulo Silva

Reputation: 3

Microsoft Acess retrieving count rows in a table

In Acess how i can select a number of rows in a table from some number count that a user specifies.

For example, this DB is prompting to a user introduces a given number, p.e: 10, and the table retrives 10 records, given a table from 100 or 10000 records

Upvotes: 0

Views: 35

Answers (1)

Gustav
Gustav

Reputation: 55831

Use dynamic SQL:

Dim rs  As DAO.Recordset
Dim Top As Integer

Top = 10  ' User input.

Set rs = CurrentDb.OpenRecordset("Select Top " & Str(Top) & " * From YourTable")

Upvotes: 1

Related Questions