Nope. You can't use a parameter for the <n> value in the TOP clause. You could prompt the user for the value in code and then dynamically build the SQL.
John Viescas, author "Building Microsoft Access Applications" "Microsoft Office Access 2003 Inside Out" "Running Microsoft Access 2000" "SQL Queries for Mere Mortals" http://www.viescas.com/ > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of Travis R. Simons > Sent: Monday, August 08, 2005 3:56 PM > To: [email protected] > Subject: Re: [ms_access] Top 10 in a query > > > Thank you. > Is there any way to write a query that would ask one how many top > deals to pull up like a parameter box? > > > On 8/8/05, John Viescas <[EMAIL PROTECTED]> wrote: > > Travis- > > > > SELECT TOP 3 tblpipeline.Customer, tblpipeline.Revenue, > > tblpipeline.Probability, tblpipeline.Notes > > > > FROM tblpipeline > > > > WHERE (((tblpipeline.Printer_Consultant) Like "*simons*") AND > > ((tblpipeline.Quarter) Like "*q3*") AND ((tblpipeline.Status) Like > > "*outstanding*")) > > > > ORDER BY Revenue DESC; > > > > John Viescas, author > > "Building Microsoft Access Applications" > > "Microsoft Office Access 2003 Inside Out" > > "Running Microsoft Access 2000" > > "SQL Queries for Mere Mortals" > > http://www.viescas.com/ > > > > > -----Original Message----- > > > From: [email protected] > > > [mailto:[EMAIL PROTECTED] On Behalf Of Travis R. Simons > > > Sent: Monday, August 08, 2005 2:00 PM > > > To: [email protected] > > > Subject: Re: [ms_access] Top 10 in a query > > > > > > > > > John, > > > Can you help me with your information for the following > real qry? I > > > want to pull the top three by revenue. > > > > > > > > > SELECT tblpipeline.Customer, tblpipeline.Revenue, > > > tblpipeline.Probability, tblpipeline.Notes > > > > > > FROM tblpipeline > > > > > > WHERE (((tblpipeline.Printer_Consultant) Like "*simons*") AND > > > ((tblpipeline.Quarter) Like "*q3*") AND ((tblpipeline.Status) Like > > > "*outstanding*")); > > > > > > > > > > > > On 6/9/05, John Viescas <[EMAIL PROTECTED]> wrote: > > > > Travis- > > > > > > > > SELECT Top 10 MyTable.* > > > > FROM MyTable > > > > ORDER BY SalesAmt DESC; > > > > > > > > John Viescas, author > > > > "Building Microsoft Access Applications" > > > > "Microsoft Office Access 2003 Inside Out" > > > > "Running Microsoft Access 2000" > > > > "SQL Queries for Mere Mortals" > > > > http://www.viescas.com/ > > > > > > > > > -----Original Message----- > > > > > From: [email protected] > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of > Travis R. Simons > > > > > Sent: Thursday, June 09, 2005 6:53 PM > > > > > To: [email protected] > > > > > Subject: [ms_access] Top 10 in a query > > > > > > > > > > > > > > > I would like to know how to pull a query for the top > ten dollar > > > > > amounts, of 200 entries, in descending orders. > > > > > > > > > > -- > > > > > Travis Simons > > > > > 512.388.5808 > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Travis Simons > > > 512.388.5808 > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > > > --------------------~--> > > > <font face=arial size=-1><a > > > href="http://us.ard.yahoo.com/SIG=12h9afc16/M=362335.6886445.7 > > > 839731.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1123534824 > > > /A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/to > > > pics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http: > > > //groups.yahoo.com/">In low income neighborhoods, 84% do not > > > own computers. At Network for Good, help bridge the Digital > > > Divide!</a>.</font> > > > -------------------------------------------------------------- > > > ------~-> > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > -- > Travis Simons > 512.388.5808 > > > ------------------------ Yahoo! Groups Sponsor > --------------------~--> > <font face=arial size=-1><a > href="http://us.ard.yahoo.com/SIG=12h7hlv7h/M=362131.6882499.7 > 825260.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1123541744 > /A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org > ">Get Bzzzy! (real tools to help you find a job) Welcome to > the Sweet Life - brought to you by One Economy</a>.</font> > -------------------------------------------------------------- > ------~-> > > > Yahoo! Groups Links > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h8opn65/M=362329.6886308.7839368.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1123544226/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
