Results 1 to 14 of 14

Thread: [RESOLVED] microsoft access & excel combo box

  1. #1

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Resolved [RESOLVED] microsoft access & excel combo box

    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?
    Last edited by yanty; Jan 23rd, 2006 at 01:09 AM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: microsoft access combo box

    Access VBA question moved to Office Development.

  3. #3

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Re: microsoft access combo box

    Oh sorry. Thanks Hack.

  4. #4
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: microsoft access combo box

    Hi!!!

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


  5. #5

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Re: microsoft access combo box

    Hi! Manually added.

  6. #6
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: microsoft access combo box

    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...

  7. #7

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Re: microsoft access combo box

    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.
    Attached Images Attached Images  
    Last edited by yanty; Jan 12th, 2006 at 10:53 PM.

  8. #8
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: microsoft access combo box

    Hi attach these codes in the visual basic IDE in MS Excel....

    VB Code:
    1. Private Sub cmdAdd_Click()
    2.     'add items to combo box
    3.     ComboBox1.AddItem ("Hi")
    4.     ComboBox1.AddItem ("Hello")
    5.    
    6. End Sub
    7.  
    8. Private Sub CommandButton1_Click()
    9.     'clear the combo box
    10.     ComboBox1.Clear
    11. End Sub

    You should add three dtpicker individually(one at a time) in order for it to function correctly

  9. #9

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Re: microsoft access combo box

    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.
    Attached Images Attached Images  

  10. #10
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: microsoft access combo box

    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:
    1. Private Sub ComboBox1_DropButtonClick()
    2.     ComboBox1.Clear
    3.     ComboBox1.AddItem ("classic")
    4.     ComboBox1.AddItem ("exclusive")
    5. End Sub



  11. #11

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Re: microsoft access combo box

    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..

  12. #12
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: microsoft access combo box

    Hi Yanty!!!!

    Try this......

    VB Code:
    1. Private Sub ComboBox1_DropButtonClick()
    2.     Static found As Integer
    3.    
    4.     If found = 0 Then
    5.          ComboBox1.AddItem ("classic")
    6.          ComboBox1.AddItem ("exclusive")
    7.          found = 1
    8.     Else
    9.            'do nothing
    10.     End If
    11.    
    12. End Sub



  13. #13

    Thread Starter
    Lively Member yanty's Avatar
    Join Date
    Nov 2005
    Location
    Singapore
    Posts
    83

    Re: microsoft access combo box

    It worked. thank u so much!

  14. #14
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: [RESOLVED] microsoft access & excel combo box

    Hi yanty!!!


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

    Greg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width