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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Filter Issue

Status
Not open for further replies.

lamaar

Technical User
Jun 29, 2000
392
GB
I have a list of products in a table. I wish to display only the top 20 of the list, or maybe enter a number.

what would be the best way to do this?

thanks

Lamaar75@hotmail.com
 
How do you want to do this: in a query?

When you sat "top 20" how would this be determined (e.g., by sales, value, price, etc.)?

[tt]________________________________________________________________
[pc2]Roger
Life is a game of cards in which the deck contains only jokers.[/tt]
 
If the record source of your form is the table directly,
you could try
Me.Recordsource="Select TOP 20 From table"
Me.Requery

You can extend this by having a combo box with values 10, 20, ...
and then
Me.Recordsource="Select TOP " & combo & " From table"
Me.Requery

If the recordsource is a Query, then you could use, that the query must start with "Select" (6 chars).

Then you could define a QueryDef variable, set it to your query and alter the query like this:
Dim qdf as Querydef
...
qdf.SQL="SELECT TOP " & combo & Mid(qdf.SQL,7)
...

Hope this helps,
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Sorry,

forgot: you have to specify TOP 20 of what, of course.
(SELECT TOP 20 ID From... or similar)
 
Hi guys,

thanks for responding.

I would run it in a qury and then run reports of the query

if possible, i would like to have the opportunity to enter a number and it gives me the top #, according to the number. it would basically look at a number field which would have been calculated previously.

regards

Lamaar75@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top