Re: Default value in a combo box
- From: "Ken Snell [MVP]" <kthsneisllis9@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 19:36:16 -0400
Combo boxes are used on a form... so I'm confused by your description of
"not using user forms but in a standard combo box"?
More information, please.
--
Ken Snell
<MS ACCESS MVP>
"jwh" <jwh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A3B0C601-7754-423D-B49B-9A7531E19164@xxxxxxxxxxxxxxxx
> What if you were not using user forms but a standard combo box. I have a
> combo box that puts the value of the "list" in a cell that the cursor was
> in
> when I double click it. But I would like to have a default value - any
> suggestions.
>
> "Ken Snell [MVP]" wrote:
>
>> Is SourceID the name of the combo box? It shouldn't be, but if it is, use
>> this:
>>
>> Me!SourceID.Value = Me!SourceID.ItemData0)
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>> "Dan" <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:88E5880F-0166-4790-9EBF-A9DA8AA23014@xxxxxxxxxxxxxxxx
>> > Ken:
>> > I tried:
>> > Private Sub Form_Load()
>> >> Me.SourceID.Value = Me.SourceID.ItemData(0)
>> >> End Sub
>> >
>> > Doesn't work. Data is in table tblSource with 2 fields: SourceID and
>> > Source.
>> > Combo looks at this table. Did I misinterpret your suggestion?
>> > Thanks,
>> > Dan
>> >
>> > "Ken Snell [MVP]" wrote:
>> >
>> >> You'll need to run code that sets the combo box value to the desired
>> >> value.
>> >> If you want this to occur when the form opens, you could use the
>> >> form's
>> >> Load
>> >> event to do this. In the example below, I'm setting the combo box to
>> >> the
>> >> first item in its list:
>> >>
>> >> Private Sub Form_Load()
>> >> Me.ComboBoxName.Value = Me.ComboBox.ItemData(0)
>> >> End Sub
>> >>
>> >> --
>> >>
>> >> Ken Snell
>> >> <MS ACCESS MVP>
>> >>
>> >>
>> >>
>> >> "Dan" <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> >> news:4CFC3003-B1A0-4E14-8599-57642AF6651D@xxxxxxxxxxxxxxxx
>> >> >I have a form with a combo box listing a series of values. Instead of
>> >> >a
>> >> > NotInList routine, I would like to have a default value appear in
>> >> > the
>> >> > combo
>> >> > box when a new form is opened so that the user can tab to the combo
>> >> > box
>> >> > and
>> >> > either accept the default value or pull down the list to select a
>> >> > different
>> >> > value. Any help appreciated.
>> >> > Thanks,
>> >> > Dan
>> >>
>> >>
>> >>
>>
>>
>>
.
- References:
- Default value in a combo box
- From: Dan
- Re: Default value in a combo box
- From: Ken Snell [MVP]
- Re: Default value in a combo box
- From: Dan
- Re: Default value in a combo box
- From: Ken Snell [MVP]
- Re: Default value in a combo box
- From: jwh
- Default value in a combo box
- Prev by Date: Re: Conditional formatting of Listbox rows ?
- Next by Date: Re: Combobox help
- Previous by thread: Re: Default value in a combo box
- Next by thread: Forms lock up
- Index(es):
Relevant Pages
|