AccessBlog.net

News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Alex
Name:Alex Dybenko

Location:Moscow, Russia

Tuesday, March 07, 2006

How to set combobox or listbox to its first item

If the first column is the bound column – then the code would look like this:

Me.Combo1 = Me.Combo1.Column(0, 0)

To set a default value of combobox to its first item you can use similar approach:

Me.Combo1.DefaultValue = Me.Combo1.Column(0, 0)

2 Comments:

Blogger Raider said...

Bad guess...

Note that BoundColumn property can differ from Combo to combo.

The right one is:
Me.Combo1 = Me.Combo1.ItemData(0)

12:37 PM  
Blogger Alex Dybenko said...

right, but this is why i mentioned "first column in bound"

10:11 AM  

Post a Comment

Links to this post:

Create a Link

<< Home