Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    userform particular (2000-sr1)

    why....
    Label8 fill all item in listbox2.
    botton cancella tutto delete all item in listbox2

    but, assuming i select a item from combobox2 for example 4500..., the listbox2 if filled with 4500, all is ok.
    now i select from label8 all item the list box2 is filled ok.
    now i press botton cancella tutti, ok.
    into combobox2 remain filled wit a item ok
    if i click on the same item for insertion in listbox2.... the code not fill the listbox2, why?

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

    Re: userform particular (2000-sr1)

    The combo box reacts to a change in its value, but since you click on the same item that was already selected, there is no change. You could clear the combo box from the Cancella Tutto button:

    Private Sub CommandButton3_Click()
    ListBox2.Clear
    ' Suppress the On Change event of the combo box
    mIgnoreEvents = True
    ' Clear the combo box
    Me.ComboBox2 = Null
    ' Enable events again
    mIgnoreEvents = False
    End Sub

    And modify ComboBox2_Change as follows:

    Private Sub ComboBox2_Change()
    If mIgnoreEvents = True Then Exit Sub
    ...

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    no dubt.... you are a Wiz... work perfect!

    Naturally you are only the one person when post code explain always the structure and that is only about a excellent man!
    Tks Hans as usual.
    Sal

    I hope all Louge read my this reply.

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    Hi Hans welcome in my home...
    About this userform is possible to list in into listbox1 the item in 6 columns in this mode...
    example:
    column 1 column2 column3 column4 column5 column6
    SK-4001 G MESSAGGI SWIFT IN PARTENZA the value show in cbomese ....cboanno ...cbodate
    SK-4002 G MESSAGGI SWIFT IN ARRIVO the value show in cbomese ....cboanno ...cbodate
    SK-6001 G OPERAZ.IN DERIVATI(SEGN.PERD.) the value show in cbomese ....cboanno ...cbodate
    .... ..... ........ ........ .......... .......

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

    Re: userform particular (2000-sr1)

    1) Set the ColumnCount property of ListBox1 to 6
    2) Set the ColumnWidths property of ListBox1 to (for example) 36 pt;12 pt;144 pt;30 pt;42 pt;48 pt
    3) Make ListBox1 much wider, for example 324.

    Replace the line

    Me.ListBox1.AddItem Me.ComboBox1

    with

    Me.ListBox1.AddItem Left(Me.ComboBox1, 7)
    Me.ListBox1.List(intListCount, 1) = Mid(Me.ComboBox1, 9, 1)
    Me.ListBox1.List(intListCount, 2) = Mid(Me.ComboBox1, 13)
    Me.ListBox1.List(intListCount, 3) = Me.cboAnno
    Me.ListBox1.List(intListCount, 4) = Me.cboMese
    Me.ListBox1.List(intListCount, 5) = Me.cboDate

    You must do this for both occurrences.

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    Hans work perfect!
    But i have maked a code to controll if already existis a value into listbox1 and it nort work now?!
    last project attached...

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

    Re: userform particular (2000-sr1)

    That is because you compare the selected item in the combo box with the items in the list box, but the text of the combo box item has now been spread over 3 columns of the list box.

    Change the line that compares the items to
    <code>
    If LCase(Me.ListBox1.List(intCounter, 0) & "-" & _
    Me.ListBox1.List(intCounter, 1) & " - " & _
    Me.ListBox1.List(intCounter, 2)) = LCase(strSK) Then</code>

  8. #8
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    understand...
    But the controll, now, is on all joined five value...

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

    Re: userform particular (2000-sr1)

    What do you mean?

  10. #10
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    in effect, npw, the controll dupes, is on a joined all value of 6 columns...
    if i have undertsand you make a joined with only 2 value, or not?

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

    Re: userform particular (2000-sr1)

    The values in the combo box correspond to the values in the first three columns of the list box (columns 0, 1 and 2, since counting starts at 0), so the code I posted checks against those three columns. If you would include ALL columns of the list box, you'd never find a duplicate, since the year, month and date are not in the combo box.

  12. #12
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    ... morning Hans
    I have maked a correction on code to refre textbox1 to controll dupes, but not work!, (natutrally)...
    Ifd you have aother way are welcome...

    In effect dont wont to permit the user to insert a dupes af value alreday existis inti listbox1.
    The controll all part of item inserted in list box1.
    Example i insert SK-4001 G MESSAGGI SWIFT IN PARTENZA 2006 GENNAIO 10/01/2006 in listbox1, ok
    if i select, for error, the same value not permit a dupes into listbox1...

    hope i am clear

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

    Re: userform particular (2000-sr1)

    There is no TextBox1 on the userform.

    The check for duplicate entries in ComboBox1_Change works correctly for me.

  14. #14
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: userform particular (2000-sr1)

    ... sure it work... but work do until i not chanege the value in cbomese, cboanno,cbodate...
    If i select a different value in one of this cboxes the macro show the masgbox to advise the dupes...
    Not real! the anno or mese or date is changed and different from the value into listbox1....

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

    Re: userform particular (2000-sr1)

    If LCase(Me.ListBox1.List(intCounter, 0) & "-" & Me.ListBox1.List(intCounter, 1) & " - " & Me.ListBox1.List(intCounter, 2) & Me.ListBox1.List(intCounter, 3) & Me.ListBox1.List(intCounter, 4) & Me.ListBox1.List(intCounter, 5)) = LCase(strSK) Then

Page 1 of 2 12 LastLast

Posting Permissions

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