Show last value in combo box (1 Viewer)

boycie

Registered User.
Local time
Today, 05:12
Joined
Sep 19, 2001
Messages
45
Hi,

By default, when a form opens, for a combo box, I want to show the last value in the list ie. the max of id field. How can I do this?

The reason: There are values being entered in a form but then someone else uses that data and it would be good to load the last value rather than searching for it. Hope Ive made sense

thanks
 

vbaInet

AWF VIP
Local time
Today, 05:12
Joined
Jan 22, 2010
Messages
26,374
You can do something like this:
Code:
with me.combobox
    .Value = .itemdata(.listcount - 1)
end with
where combobox is the name of your combo box.
 

John Big Booty

AWF VIP
Local time
Today, 14:12
Joined
Aug 29, 2005
Messages
8,263
You could also put the following in the Default Value Property of your Combo Box;
Code:
=[URL="http://www.techonthenet.com/access/functions/domain/dmax.php"]DMax[/URL]("YourFieldName","YourTableName")
 

boycie

Registered User.
Local time
Today, 05:12
Joined
Sep 19, 2001
Messages
45
They both work. Thanks very much to you both
 

Users who are viewing this thread

Top Bottom