ComboBox Thread

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oren Kaplan

    ComboBox Thread

    Hello,
    I posted a msg on the Access-related groups in hope someone there
    could help me but since almost two days have past and I didnt get a
    response (Im a bit hard pressed with the problem) I thought I might
    try some of you guys since you also deal with the Visual part of
    visual basic and since vba shouldn`t be all that different from vb....
    (I changed the order of the post and edited the junk out a bit to make
    it a bit more readable but nothing except that)
    [color=blue][color=green]
    > > "Oren Kaplan" wrote:[color=darkred]
    > > > Hello All,
    > > > I have a ComboBox on my 'Main' Form (the Form is not data
    > > > bound, the ComboBox is) which i want the user to be able to
    > > > pick from and click on a command that gets the data from the
    > > > first column (4 columns are shown) and uses it in some way....
    > > > - At first it looks like this:
    > > >
    > > > ___________ _ |¯¯¯¯¯¯¯¯¯|
    > > > |Select Here|V| | Command |
    > > > ¯¯¯¯¯¯¯¯¯¯¯ ¯ |_________|
    > > >
    > > > - When you click on the arrow it cascades:
    > > >
    > > > ___________ _ |¯¯¯¯¯¯¯¯¯|
    > > > |___________|V| _________ ___________ ___________ _ | Command |
    > > > | Main ID |¯ Desc. 1 | Desc. 2 | Desc. 3 |^||_________|
    > > > |¯¯¯¯¯¯¯¯¯¯¯|¯¯ ¯¯¯¯¯¯¯¯¯|¯¯¯¯¯ ¯¯¯¯¯¯|¯¯¯¯¯¯¯¯ ¯¯¯|¯|
    > > > | Records | For | User | Selection |_|
    > > > |___________|__ _________|_____ ______|________ ___|V|
    > > > ¯
    > > > - When you select a record from the list it shows the 'Main
    > > > ID' you selected in the text portion of the ComboBox:
    > > >
    > > > ___________ _ |¯¯¯¯¯¯¯¯¯|
    > > > | Main ID |V| | Command |
    > > > ¯¯¯¯¯¯¯¯¯¯¯ ¯ |_________|
    > > > - And then when you click the Command you can refer to
    > > > ComboBox`s value and call a Sub or Function using that value.
    > > >
    > > > Thing is... The ComboBox doesn`t display its DefaultValue at
    > > > the begining and when I move the mouse over a record it only
    > > > 'selects' it, as in highlights it in black, and clicking on
    > > > them doesn`t make any difference. In the end the text portion
    > > > of the combobox is either empty as usual or full with some
    > > > spaces...
    > > >
    > > > Help anyone? Using Access2k over Win2K or NT4.....
    > > >
    > > > Thanks ahead,
    > > > Oren[/color][/color]
    >
    > Hey Arvin,
    > You wrote:[color=green]
    > > Nice Ascii art! Thanks for not posting a nice fat jpg.[/color]
    > <snip>
    > thanks :) I had to - I didn`t manage to explain my self in a better
    > way in words and I wouldn`t have gone to the trouble of screen
    > capturing anything just for that.
    > <snip>[color=green]
    > > I'd use the AfterUpdate of the combobox instead of the command button click
    > > event to run your code.[/color]
    > <snip>
    > The problem is, though - that the d**n control doesn`t even produce
    > that event! It doesn`t even get to the point where it changes... I
    > can`t type in anything and can`t select anything from the list! As
    > for everything else, well, thanks alot - I`ll keep it on the thread
    > if others want it but I still need someone to try to understand why
    > one three different computers and two different systems the combobox
    > simply won`t let anything happen to it except for the list to cascade
    > with the right data from the table...
    >
    > HELP (and thanks :),
    > Oren
    > <snip - rest of thread>[color=green]
    > > If I've missed something else, (i.e. the default
    > > value when there isn't one) you could hard code that value into the command
    > > button something like this: (aircode)
    > >
    > > Sub cmdWhatever_Cli ck()
    > > Dim MyVar
    > >
    > > MyVar = Me.cboMyCombo
    > >
    > > If Len(MyVar & vbNullString) = 0 Then
    > > MyVar = ' The default value
    > > Else
    > > MyVar = MyVar
    > > End If
    > >
    > > ' Rest of code
    > >
    > > End Sub
    > > --
    > > Arvin Meyer, MCP, MVP
    > > Microsoft Access
    > > Free Access downloads:
    > > http://www.datastrat.com
    > > http://www.mvps.org/access[/color][/color]
    <snip>
  • Mike and Jo

    #2
    Re: ComboBox Thread

    Oren Kaplan wrote:

    .....[color=blue][color=green][color=darkred]
    > > > > - And then when you click the Command you can refer to
    > > > > ComboBox`s value and call a Sub or Function using that value.
    > > > >
    > > > > Thing is... The ComboBox doesn`t display its DefaultValue at
    > > > > the begining ...[/color][/color][/color]

    If you want to set the 'DefaultValue', (I am assuming the default is the
    first value in the list):
    Combo.Text = Combo.List(0)
    [color=blue][color=green][color=darkred]
    > > > > and when I move the mouse over a record it only
    > > > > 'selects' it, as in highlights it in black, and clicking on
    > > > > them doesn`t make any difference. In the end the text portion
    > > > > of the combobox is either empty as usual or full with some
    > > > > spaces...[/color][/color][/color]

    As for the above - it is a little confusing as to what the problem is? Are
    you describing a click on an item in the combobox that produces 'empty as
    usual or full with some spaces'? If you are then you must have some code
    that is interfering with the 'normal' function of the combobox. Check your
    code for any events and references to the combobox in question. If you
    can't figure out the problem you might want to post the code related to the
    combobox.

    Regards
    Mike


    Comment

    Working...