Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Nov 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    combobox items (2003 )

    Silly, but I can't find how assign to ListIndex Number to a combobox
    it doesn't work as cmbUnits.ListIndex = 1
    I tried inSelection, selected
    Basically I have multiple combo boxes that I need to assign default selection
    if I assigned Value as a string it doesn't execute ...afterupdate() event

    thank you Alex

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: combobox items (2003 )

    If you want to set a default value for the combo box, you don't need code. In design view, set the Default Value property of cmbUnits to

    cmbUnits.ItemData(0)

    The item index is zero-based, so 0 is the first item, 1 is the second item etc.

  3. #3
    Lounger
    Join Date
    Nov 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox items (2003 )

    Hans
    It gives me compile error - "Invalid use of property"
    it compiles with cmbUnits.ItemData(0) = number or "String", but I want initialization using item number, so I could change it dynamically
    I use Access 2003 sp2
    thank you

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: combobox items (2003 )

    Please post the code you are using. It is not clear now what you are trying to do.

  5. #5
    Lounger
    Join Date
    Nov 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox items (2003 )

    Private Sub cmdDefaults_Click()
    cmbMegger.ItemData (1)
    cmbUnits.ItemData (2)
    cmbVibr.ItemData (0)
    End Sub

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: combobox items (2003 )

    Sorry, that code makes no sense. A line such as

    cmbMegger.ItemData (1)

    is meaningless. Try

    Me.cmbMegger = Me.cmbMegger.ItemData(1)

    etc.

  7. #7
    Lounger
    Join Date
    Nov 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox items (2003 )

    Hans, thank you very much

Posting Permissions

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