Re: Default combobox line

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote

> Are you saying it does not work with the Dlookup
> in the Default Value property of the combo box?

No, that works fine and is the best way to do it.
I didnt register that that was what you meant by
not doing it in an event.

The only problem with doing it from code was that you
need an = on the front of what is written to the default
value property for some reason, even tho you dont if
you put a fixed string in the default value property manually.


> "Rod Speed" wrote:
>
>> Rod Speed <rod_speed@xxxxxxxxx> wrote:
>>> Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>>
>>>> As to entering it twice, there is not much you can do about that.
>>>> I do like the idea of having a field in the table that identifies
>>>> the defalut choice. I would not suggest using an event to set it.
>>>> Instead, I think you might use a DLookUp in the default value to do
>>>> that for your: =DLookUp("[TheField]","MyTableName","[DEFAULT_ITEM]
>>>> = True")
>>>> Where [TheField] is the bound field for the combo box you want to
>>>> be the default value and [DEFAULT_ITEM] is the field you mentioned
>>>> that will tell you which is the default selection. You will need
>>>> to change the names to protect the innocent.
>>>
>>> Yeah, that's what I meant, with that
>>> control.DefaultValue=dlookup(etc) in the OnOpen event for the form.
>>>
>>>> This is an untested idea, but if it works, it
>>>> would be a cool way to do it. (I think it will)
>>>
>>> It doesnt currently for some reason, likely just a brain fart on my
>>> part tho. Although the control.DefaultValue string is correct, for
>>> some reason it doesnt end up in the control property.
>>
>> What does work is to set the Default Value to
>> =[Drive].[ItemData](1)
>> when you want the second item in the list to be the default value
>>
>> Not at all clear why I cant set it from visual basic tho.
>>
>>
>>>> Rod Speed wrote
>>>>> Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
>>>
>>>>>> I think you are on the right track. If it will always be the
>>>>>> same item in the list, regardless of position, then use the
>>>>>> Default Value property of the combo box.
>>>>>
>>>>> I dont really mind if the default value moves around in the list
>>>>> as other items are added, I just want to have one particular item
>>>>> as the default.
>>>>>
>>>>> My initial superficial reaction to the use of the default property
>>>>> was that that item has to be entered twice, once as an item in the
>>>>> table
>>>>> that contains the items, once in the default property. That isnt
>>>>> hard to fix with another field in the table that flags which item
>>>>> is the default and the OnOpen or OnLoad Event can just get that
>>>>> item and put it
>>>>> into the default property of the control.
>>>>>
>>>>>
>>>>>> "Rod Speed" wrote:
>>>>>>
>>>>>>> Larry Linson <bouncer@xxxxxxxxxxxxx> wrote
>>>>>>>
>>>>>>>> If you don't want it to be the first item in the list, what
>>>>>>>> _do_ you want it to be?
>>>>>>>
>>>>>>> One of the other items that I specify.
>>>>>>>
>>>>>>> Looks like the default value of that control is
>>>>>>> what I need from another post elsewhere.
>>>>>>>
>>>>>>>
>>>>>>>> "Rod Speed" <rod_speed@xxxxxxxxx> wrote in message
>>>>>>>> news:e%23BHgN2sFHA.2540@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>>>> OK, I've got a form that works fine with the user selecting a
>>>>>>>>> combobox entry that is required manually.
>>>>>>>>>
>>>>>>>>> I want to set the default when the form is opened so you only
>>>>>>>>> need to do that if the default isnt what you want.
>>>>>>>>>
>>>>>>>>> I dont want it to be the first item in the list, tho that
>>>>>>>>> would be a viable kludge.
>>>>>>>>>
>>>>>>>>> How do I do that ?


.



Relevant Pages

  • Re: My laptops back, and Im gonna be...
    ... For some reason the HDD failed some test, tho' it was ... >>> working fine when I recovered data off it with an external USB ...
    (uk.rec.sheds)
  • Re: Full script fails
    ... It is not a complete script when you import an external LS file called ... however for some reason it doesnt. ... in isolation prior to posting to verify that it did demonstrate the ...
    (comp.lang.javascript)
  • Re: Plot silliness HBP etc
    ... And the robe would change back when the spell wore off. ... reason thatpeople don't just zap up a big house. ... Tho her not ... about them in anything but interviews. ...
    (alt.fan.harry-potter)
  • Re: ncis
    ... Theres no reason for the makers to do it as it doesnt add or contribute ... to anything whatsoever. ...
    (uk.media.tv.misc)
  • Re: error when trying to generate random numbers with range
    ... some reason i'm getting all the time the same message ... method nexrIntdoesnt appear in random class ... "It wasn?t the Exxon Valdez captain?s driving that caused the Alaskan oil spill. ...
    (comp.lang.java.help)