Hey everyone,
I'm trying to create a query that shows the top X number of, in my case, royalty payers in our royalty database. I know I can specify the number in the design view of the query, but what I would love to do is have the user input a number and have that number be how many records are shown (i.e. top 2, top 10, top 5, etc.). I have the dialog box pop up from the Access parameters, but how do I get the SELECT TOP command to use that input number?
Code:
PARAMETERS [How many records?] Short;
SELECT TOP 5 [Royalities Y2013].F1, [Royalities Y2013].F38, [Royalities Y2013].F39, [Royalities Y2013].F40
FROM [Royalities Y2013]
ORDER BY [Royalities Y2013].F40 DESC;
Everytime I try to change the "5" after "SELECT TOP" to anything other than an integer I get an error saying that the command contains invalid arguments.
Seems like it should be easy, but I just can't get it to work
Any help would be much appreciated!
Thanks!