Dear all,
I am having a bad time on clearing existing items on a combobox.
In VB.Net, I can just simply say Combobox1.clear, but this.....GOD.....kill me big time.
Please help me.
Thank you
PlayKid
Printable View
Dear all,
I am having a bad time on clearing existing items on a combobox.
In VB.Net, I can just simply say Combobox1.clear, but this.....GOD.....kill me big time.
Please help me.
Thank you
PlayKid
Combobox1.Value = ""
no use.....
I tried
Combobox1.Value = null
Combobox1.Value = ""
Combobbox1.Value = nothing
All of them not working.
What application are you using, Excel?
The code on a Userform would beThis would normally be used when reseting/clearing the UserformCode:Me.ComboBox1.Value = ""
Access 2000...
I try to use a loop, but I can't find another component again, that's "Count", trying to remove all items on the combobox...
Anything I can think of that I can program easily in .Net, or VB6, does not work on VBA.....GOD................
Hi!!!
Is your combo box's row source type value list or field list or table/query?
Value list
You need to remove each item from the combobox one by one. Also, you need to do this in reverse order to ensure integrity between your loop counter and the ListIndex.
The following snippet will clear a combobox of all values, even when a value has been selected.
VB Code:
Dim lListIndex As Long With Me.Combo3 'Change to your combobox name .SetFocus For lListIndex = .ListCount - 1 To 0 Step -1 .RemoveItem (lListIndex) Next lListIndex .SelText = "" End With
Please ignore this if it's resolved.
...
...
Combobox1.Object.Value = ""
...
...
will clear the text in the box.
Thanks.