VBA Excel: Dynamically Reload a ComboBox

The_Big_One Posted messages 36 Status Member -  
The_Big_One Posted messages 36 Status Member -
Hello,

Hello everyone

I'm looking for how to load a comboBox dynamically after adding data.
I have a data entry form with a comboBox (product list) that loads when the form (Frm_Principal) opens, using the RowSource method.

But when entering data, a product is missing from the comboBox, I open another form to add products.
Without closing the main form, I would like the comboBox (product list) to be updated with the newly added product.
Otherwise, I have to close and reopen the main form to refresh the product list.

Thank you in advance for your help.

Configuration: Windows / Chrome 87.0.4280.141

--
Ambition is like a bicycle; if you stop pedaling, you fall.

4 answers

  1. franc38 Posted messages 197 Registration date   Status Member Last intervention   38
     
    Hello
    When you create your product
    you add to the validation: userform_concerné.combobox_concerné.value=produit
    and when you validate your entry, you restart the userform
    See you + François
    1
  2. franc38 Posted messages 197 Registration date   Status Member Last intervention   38
     
    Hello and Happy New Year
    Have you tried creating a dynamic range
    namedRange=OFFSET(Sheet5!$A$3,0,0,COUNTA(Sheet5!$A:$A),1)
    A3 being the first data cell of Sheet5

    and in the properties of the combobox
    rowsource: namedRange

    Cheers François
    0
  3. The_Big_One Posted messages 36 Status Member 2
     
    Good evening Franc38,
    Thank you for your proposal,
    the product list is a dynamic table.
    However, I am encountering an issue with refreshing a combobox on an already opened form.

    In this image, I notice that I am missing a product from the dropdown list. So I open another product addition form.


    Once the product is added, I close this form and return to the form where I started my input.
    And that’s when the last added product is not present in the dropdown list of products.
    So I am looking for how to update this combobox.

    Otherwise, when I close and reopen the main form, the list is updated.
    If I have to close the form after each entry of a missing product, it will make the work too cumbersome.

    Looking forward to your help.
    Regards
    Claude
    --
    Ambition is like riding a bicycle, if you stop pedaling, you fall.
    0
  4. The_Big_One Posted messages 36 Status Member 2
     
    Good evening Franc38,
    thank you for your response,
    But I kept it simpler: instead of having a separate form for adding products,
    I embedded it into the main form and the combo box refreshes as I wanted.
    once again thank you

    --
    Ambition is like a bicycle; if you stop pedaling, you fall.
    0