i'm new to using microsoft access. so i wonder if anyone knew how do we add lists to microsoft access's combobox? ag. when we add a list of items in vb combobox, we put them under list property box. how do we do the same for microsoft access?
Printable View
i'm new to using microsoft access. so i wonder if anyone knew how do we add lists to microsoft access's combobox? ag. when we add a list of items in vb combobox, we put them under list property box. how do we do the same for microsoft access?
Access VBA question moved to Office Development.
Oh sorry. Thanks Hack.
Hi!!!
Is your combo box bound to a table/query or your values will be manually added?
:) :) :)
Hi! Manually added.
If you added a combo box to your form, change the following properties:
Row Source Type: Value List
Row Source: BeefSteak, Chicken Curry, Fried Rice
beef steak, chicken curry and fried rice are the values manually added to row source... :) :) :)
Gee.. Thks. What about Microsoft Excel? How do we manually add items to the combobox. i have 3 dtpickers.when i clicked on dtpicker, it is able to show the calendar image. but when i clicked the other 2, it either appeared bigger or didnt show the clanedar image.
Hi attach these codes in the visual basic IDE in MS Excel....
VB Code:
Private Sub cmdAdd_Click() 'add items to combo box ComboBox1.AddItem ("Hi") ComboBox1.AddItem ("Hello") End Sub Private Sub CommandButton1_Click() 'clear the combo box ComboBox1.Clear End Sub
You should add three dtpicker individually(one at a time) in order for it to function correctly
:) :) :)
Yes, can. But there seemed to be a problem. When I clicked an item in the combobox, it automatically duplicate the items i had put in the combobox. originally i had inserted only classic and exclusive. it seemed excel is more difficult to program than visual basic huh.
Yes, in fact I also had quiet some time learning the VBA in MS Access. Some VBA codes differ slightly since each MS Office has different functionalities...However, the basic statements of VB is applicable to all MS Office VBA programming..
Try this if you want your combo box will not display duplicate values...
VB Code:
Private Sub ComboBox1_DropButtonClick() ComboBox1.Clear ComboBox1.AddItem ("classic") ComboBox1.AddItem ("exclusive") End Sub
:) :) :)
Yeah, it didn't duplicate. But the item that I select did not display on the combobox. The combobox doesnt show that i choose classic for eg. Hmm.. :rolleyes:
Hi Yanty!!!!
Try this......
VB Code:
Private Sub ComboBox1_DropButtonClick() Static found As Integer If found = 0 Then ComboBox1.AddItem ("classic") ComboBox1.AddItem ("exclusive") found = 1 Else 'do nothing End If End Sub
:) :) :)
It worked. thank u so much!
Hi yanty!!!
Your welcome......Glad to be of service!!!!!!
Greg :) :) :) :)