Results 1 to 5 of 5
  1. #1
    Michael T is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2011
    Posts
    16

    deactivate a combo box

    Hi,



    I have a number of combo boxes on a form and I want combo box 2 greyed out/deactivated until combo box 1 is filled in, can I do this?

    Michael

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    You need two bits of VBA.

    Code:
    Private Sub Form_Load()
            cbo2.Enabled = False
            
    End Sub
    
    
    Private Sub cbo1_AfterUpdate()
        If Len(cbo1) <> 0 Then
            cbo2.Enabled = True
        Else
            cbo2.Enabled = False
             
        End If
        
    End Sub
    The first one greys out the second combo box on loading the form.
    The second one ungreys it if the first combo box contains data.

  3. #3
    Michael T is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2011
    Posts
    16
    Thanks, that has worked a treat.

  4. #4
    Michael T is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2011
    Posts
    16
    How do I mark this thread as solved?

  5. #5
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Click on thread tools at the top of the posting and select Solved.

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

Similar Threads

  1. Replies: 4
    Last Post: 08-16-2011, 05:54 PM
  2. F11 deactivate
    By Cheshire101 in forum Security
    Replies: 4
    Last Post: 03-30-2011, 02:19 PM
  3. Replies: 5
    Last Post: 01-02-2011, 10:09 AM
  4. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  5. Replies: 0
    Last Post: 08-17-2008, 12:19 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