Combo Boxes

stevenmurfitt

New member
Local time
Today, 23:53
Joined
Nov 24, 2006
Messages
4
I have a Combo Box on a form that searches for records, is it possible to populate that Combo Box with say the last 10 entries from the user?
 
Yep, to get the last 10 records from one of your tables, create your combo box and set it up to show the data you want (the columns from the table) and just have it show all rows for now. Then in Design view, modify the SQL statement in the control's properties... Properties -> Data -> Row Source. (click '...'). Go to SQL View (right-click on the grey space above) and add the following SQL to your query (new code in blue):
Code:
SELECT [COLOR="RoyalBlue"]TOP 10[/COLOR] FROM 
[ ... ]
[COLOR="RoyalBlue"]ORDER BY [table].[column] DESC[/COLOR]

Add your table and column into the SQL above. The ORDER BY code goes at the end of your SQL query. For the column to order by, the simplest may be to order by your Primary key, however if you have a Date column that may be more appropriate. You should now have a maximum of 10 records showing in your combo box, newest at the top.
 

Users who are viewing this thread

Back
Top Bottom