|
-
Jan 30th, 2006, 06:20 AM
#1
Thread Starter
Hyperactive Member
VBA Combo Box
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
-
Jan 30th, 2006, 06:58 AM
#2
Lively Member
-
Jan 30th, 2006, 07:09 AM
#3
Thread Starter
Hyperactive Member
Re: VBA Combo Box
no use.....
I tried
Combobox1.Value = null
Combobox1.Value = ""
Combobbox1.Value = nothing
All of them not working.
-
Jan 30th, 2006, 07:13 AM
#4
Lively Member
Re: VBA Combo Box
What application are you using, Excel?
The code on a Userform would be
Code:
Me.ComboBox1.Value = ""
This would normally be used when reseting/clearing the Userform
-
Jan 30th, 2006, 07:20 AM
#5
Thread Starter
Hyperactive Member
Re: VBA Combo Box
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................
-
Feb 1st, 2006, 03:48 AM
#6
Re: VBA Combo Box
Hi!!!
Is your combo box's row source type value list or field list or table/query?
-
Feb 1st, 2006, 04:21 AM
#7
Thread Starter
Hyperactive Member
-
Feb 1st, 2006, 10:37 AM
#8
Re: VBA Combo Box
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
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Apr 27th, 2007, 04:42 PM
#9
New Member
Re: VBA Combo Box
Please ignore this if it's resolved.
...
...
Combobox1.Object.Value = ""
...
...
will clear the text in the box.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|