pouplate limited values in a list box?

a4aj

Registered User.
Local time
Yesterday, 16:19
Joined
Jan 10, 2007
Messages
16
populate limited values in a list box?

:confused: :confused: I have a challenge of populating just 10 latest values from a column of a table to a list ..Can anyone help me solve this please?
 
Last edited:
How can you determine which values are the ten latest
 
I am determining the latest by the date I enter! Is it a difficult task?
 
a4aj said:
Can anyone help me?

Yes

If you are storing the Date entered in the table you could set the record source of the listbox/combobox to

Code:
SELECT Table.Value
FROM Table
ORDER BY Table.DateEntered DESC
[code]

Now that gets you all of them sorted by their date from most recent on, but not  just the last 10

you might be able to do

[code]
SELECT Table.Value, Count(Table.Value) AS count
FROM Table
WHERE count < 10
ORDER BY Table.DateEntered DESC
[code]

But I'm not sure if that'll work or not. Access doesn't support ROWCOUNT so I'm not sure if the only 10 records is an option.
 
in the query design view you can select 'top' values, either from the property sheet or the combo box in the menubar. sort your dates descending and have them first in the query.

you will end up with something like

Code:
SELECT TOP 5 Table1.Field1, Table1.Field2
FROM Table1
ORDER BY Table1.Field1 DESC;

be aware though that this wont split a draw! if you have the same date in rows 10 and 11 it will return 11 results!

Peter
 
Thanks a lot,WIll try and post my results!
 

Users who are viewing this thread

Back
Top Bottom