PDA

Click to See Complete Forum and Search --> : [RESOLVED] microsoft access & excel combo box


yanty
Jan 11th, 2006, 12:47 PM
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?

Hack
Jan 11th, 2006, 12:54 PM
Access VBA question moved to Office Development.

yanty
Jan 11th, 2006, 01:00 PM
Oh sorry. Thanks Hack.

KGComputers
Jan 11th, 2006, 10:09 PM
Hi!!!

Is your combo box bound to a table/query or your values will be manually added?

:) :) :)

yanty
Jan 12th, 2006, 07:06 AM
Hi! Manually added.

KGComputers
Jan 12th, 2006, 08:23 PM
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... :) :) :)

yanty
Jan 12th, 2006, 09:04 PM
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.

KGComputers
Jan 13th, 2006, 01:00 AM
Hi attach these codes in the visual basic IDE in MS Excel....


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
:) :) :)

yanty
Jan 14th, 2006, 12:25 AM
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.

KGComputers
Jan 14th, 2006, 09:49 AM
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...


Private Sub ComboBox1_DropButtonClick()
ComboBox1.Clear
ComboBox1.AddItem ("classic")
ComboBox1.AddItem ("exclusive")
End Sub



:) :) :)

yanty
Jan 16th, 2006, 03:41 AM
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:

KGComputers
Jan 16th, 2006, 10:55 PM
Hi Yanty!!!!

Try this......


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




:) :) :)

yanty
Jan 22nd, 2006, 09:40 PM
It worked. thank u so much!

KGComputers
Jan 23rd, 2006, 07:32 PM
Hi yanty!!!


Your welcome......Glad to be of service!!!!!!

Greg :) :) :) :)