+ Reply to Thread
Results 1 to 2 of 2

combo box not showing selected item..

  1. #1
    nycdon
    Guest

    combo box not showing selected item..

    hi,
    i'm using the mousedown event on a an Office Excel 2003 user form combobox,
    to trigger ADO calls to Access to populate the dropdown. I also clear out the
    combobox each time, so the list doesn't duplicate each time it's clicked.
    However, if mouse released (up), then selects an item and clicks (down), the
    selected item does not show in combobox - it's always the 1st item in list
    that shows.
    If I do not release mouse (up), and select from list, it works fine. It's
    like the mousedown event executes again when i select the item.

    any idea as to how I could handle this? i'm pretty new to working with
    mousedown/up events.

    thanks!
    Don



  2. #2
    sebastienm
    Guest

    RE: combo box not showing selected item..

    Hi,
    Not sure i get but:

    - You could track whether an event occurs because of a direct user action or
    because of your code has triggered some control's event. Set a variable
    called UserTrigger as boolean.
    - use it to manage when the code within an event should be executed:
    - if the event is triggered because you are modifying things through code
    then don't execute
    - if the event is triggered because of actions from the user then do
    execute

    Private Sub ComboBox1_MouseUp( ... )
    if UserTriggered then
    'Start by setting UserTriggered to False
    'Process code here which changes controls
    '... (1)
    'Reset UserTriggered to True
    End Sub

    eg, if you chancge a control in the above code at the leve of (1) (see
    above) and this action triggers another control's _Change event. At (1), the
    code jumps to that other control 's _Change code; however you know
    UserTriggered is False, so avoid processing code in a If-Then.

    I hope i was clear enough, ... not sure about that... :-)
    --
    Regards,
    S├ębastien
    <http://www.ondemandanalysis.com>


    "nycdon" wrote:

    > hi,
    > i'm using the mousedown event on a an Office Excel 2003 user form combobox,
    > to trigger ADO calls to Access to populate the dropdown. I also clear out the
    > combobox each time, so the list doesn't duplicate each time it's clicked.
    > However, if mouse released (up), then selects an item and clicks (down), the
    > selected item does not show in combobox - it's always the 1st item in list
    > that shows.
    > If I do not release mouse (up), and select from list, it works fine. It's
    > like the mousedown event executes again when i select the item.
    >
    > any idea as to how I could handle this? i'm pretty new to working with
    > mousedown/up events.
    >
    > thanks!
    > Don
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1