Results 1 to 6 of 6
  1. #1
    b.saimsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    24

    when Command Button click need to display specific values at Combo box

    I have Created a form and in that forum 2 main command button click and each command have 2 sub command button clicks. Depend upon sub command button Click need to display the Specific Combo box dropdown.........I have written code like this



    Private Sub Selection1_Click()


    Combobox = "Z11110" and "Z222222" and "Z434343"


    End Sub

    Private Sub Selection2_Click()


    Combobox = "Y11110" and "Y222222" and "Y434343"


    End Sub

    But i am getting Error



    I have attached a demographics..please review and help me..........Thank you
    Attached Thumbnails Attached Thumbnails demo1.jpg  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    The error is because 'and' has no meaning as you have used it.

    I don't understand what you are trying to do. Do you want to change the combobox RowSource dependent on some other criteria? How are the 2 main command buttons relevant to this?

    The combobox RowSourceType property must be set to ValueList for code to change the RowSource property with a limited list:

    Me.comboboxname.RowSource = "Z11110;Z222222;Z434343"

    You have the combobox sized like a listbox. Above applies to listbox as well.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    b.saimsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    24
    Hi Super Moderator, Thank you very much for your reply....I need one more help depend upon row selection from Combo box or List box the text should be displayed at Text box. Please help me....Thank you

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    What do you want displayed in textbox?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    b.saimsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    24
    Me.comboboxname.RowSource = "Z11110;Z222222;Z434343" given it's works fine.

    Ex: Z11110 have some meaning like "Zee11110 is the first product of the year" So when i am click/selected Z11110 in Combo box / List box i have that description has to display at another newly created Text box.

    Please help me! Thank you in advance...........

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    How do you know it is the first product of the year?

    Options:

    1. expression in textbox ControlSource: =[comboboxname] & " is the first product of the year."

    2. code in the combobox AfterUpdate event can populate textbox with whatever you want it to say
    Me.textboxname = Me.combobox & " whatever you want to say."
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 04-14-2012, 07:22 PM
  2. Replies: 1
    Last Post: 03-31-2012, 01:38 PM
  3. Replies: 1
    Last Post: 03-19-2012, 11:03 AM
  4. Replies: 11
    Last Post: 06-02-2011, 10:21 AM
  5. Command button click event
    By R_jang in forum Programming
    Replies: 10
    Last Post: 10-29-2010, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums