Results 1 to 7 of 7
  1. #1
    siema24 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    22

    Forms - disable/enable combobox depending on another combobox value

    Hi, I'm wondering how enable or disable (gray-out) combobox A depending on B combobox value choice.
    Should I use some A combo after_update VBO code? Could you please give me any example showing how to solve this issue? : ) Thanks!

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In the AfterUpdate event procedure of combobox B, add If ..... then Me!comboboxA.Enabled=False - also there is Locked=True.

  3. #3
    siema24 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    22
    Thank you. It's working well however when it comes to a "tabular" form (form rows count = elements count) another problem occured.
    If I have, for example three elements in my table (in form as well), then changing B-value in any of those three leads to enable/grey-out fields for all of them.
    Please help, thanks so much! : )

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Use conditional formatting instead. Go to comboboxA, select conditional formatting, new rule, expression is, comboboxB="x", then click on the enabled button

  5. #5
    siema24 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    22
    Great! Works just fine. Thanks : )
    Last question - is there any way to not only grey out and disable a combobox but also set it's value to, for example, Null?

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    That is a data issue, not a "looks" issue, and can be done in VBA after the correct event such as post #2.

  7. #7
    siema24 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    22
    Thanks, I solved "data" issue by changing VBA code.

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

Similar Threads

  1. Create a ComboBox depending from another
    By SaPires in forum Access
    Replies: 2
    Last Post: 06-03-2014, 07:42 AM
  2. Button action depending on combobox value
    By Mattbro in forum Programming
    Replies: 3
    Last Post: 03-20-2014, 08:36 AM
  3. Tetbox text depending on a combobox.
    By schwabe in forum Forms
    Replies: 5
    Last Post: 01-24-2012, 05:56 PM
  4. Changing calculation depending on Combobox
    By GraemeG in forum Programming
    Replies: 29
    Last Post: 02-15-2011, 11:33 AM
  5. change a combobox value depending on another
    By emadaldin in forum Access
    Replies: 3
    Last Post: 01-17-2011, 01:06 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