Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top x records

Status
Not open for further replies.

PortyAL

Technical User
May 13, 2005
126
GB
I have a query in a database which returns the top 50 records in a table, with the "50" being set in design view. However, I do not always want the top 50 - sometimes I need more, sometimes less. Is it possible to program the query so that when you run it, it asks you how many records you want displayed?

Thanks

AL
 
I think you need to copy the query into a VBA module, pick up the variable element from a form and run the dynamically built SQL from VBA.

 
or you could try to modify the querydef's .sql property to re-edit the sql string before running it...

--------------------
Procrastinate Now!
 
This topic has been covered recently.
Do a Search in this forum for top parameter

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top