Results 1 to 6 of 6
  1. #1
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65

    How to grey out controls

    Hi All,


    I need help again but hey what's new . I have a data input form and the first item to be filled in by the user is a combo box (cboSelect) which contains two options. I want the form to work so that if the user picks say 'Option A' from the combo box then 3 or 4 other controls will be greyed out as they would become irrelevant for that option. Would anyone be familiar with the code to make this possible ?. The controls i would like to be greyed out are called


    cboPlant
    txtDay
    txtShift
    txtArea

    Thanks in advance,
    Em

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Following code disables a control
    Code:
    Me.ControlName.Enabled=False
    You will need to build the logic to enable/disable it based on user selection

  3. #3
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65
    Thanks for the reply, but building that logic is way above my head unfortunately

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Give it a try something like -
    Code:
    If Me.cboSelect="A" then
    Me.ControlName1.Enabled=False
    Me.ControlName2.Enabled=False
    Me.ControlName3.Enabled=False
    Else
    Me.ControlName1.Enabled=True
    Me.ControlName2.Enabled=True
    Me.ControlName3.Enabled=True
    EndIf

  5. #5
    Emma35 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Ireland
    Posts
    65
    Wow it actually worked first time !. Thanks a lot for your help....it's much appreciated

    Emma x

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Note that in addition to having your code in the AfterUpdate event of the Combobox, you'll need it in the Form_Current event, as well, so that the formatting is record-appropriate as you move from record-to-record.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 3
    Last Post: 08-29-2013, 02:10 AM
  2. .MDE opens as grey box..
    By redbull in forum Access
    Replies: 1
    Last Post: 06-04-2013, 07:55 AM
  3. Unwanted grey combo box fields on form
    By wouterv81 in forum Forms
    Replies: 1
    Last Post: 04-25-2012, 02:42 AM
  4. Grey stripe/box on forms
    By MissVinegar in forum Forms
    Replies: 2
    Last Post: 02-09-2012, 10:04 AM
  5. Toolbox grey
    By Jas_The_Ace in forum Forms
    Replies: 1
    Last Post: 02-27-2009, 08:20 AM

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