Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2011
    Posts
    1

    Unanswered: Drop Down Active only if Previous Drop Down Field is chosen

    I'm a pretty novice Access user so please help me. I'm trying to amend an existing Form by adding an Drop Down option "Approved" or "Not Approved". If Approved is selcted, they must move on to the next field which is also a drop down menu 1) Does meet criteria or 2)Not available. How do activate the second drop down only if the first one is Approved?

    I need to create this in design view, as apposed to actual coding, so can anyone help me figure out how to do this (in design view)?

    Thanks!

  2. #2
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    You could possibly do this;
    In the data tab of the second combo box say Enabled = No, and Locked = Yes. This will make the default unchangeable. You then want the form to requery this, and enable the combo as required on each record so include this sub on your form;

    Code:
    Private Sub Form_Current()
    
    On Error GoTo Err_Form_Current
    
    If Me.Combo1 = "Approved" Then
    
    Me.Combo2.Enabled = True
    Me.Combo2.Locked = False
    
    Else
    
    Me.Combo2.Enabled = False
    Me.Combo2.Locked = True
    
    End If
    
    Exit_Form_Current:
        Exit Sub
    
    Err_Form_Current:
        MsgBox Err.Description
        Resume Exit_Form_Current
    
    End Sub
    The above changes the combo box based on what the first combo box starts as. You also need to do the same thing once you change the first combo box, so I would also put the above behind Combo1 AfterUpdate.

    Code:
    Private Sub Form_Combo1_AfterUpdate()
    
    On Error GoTo Err_Combo1_AfterUpdate
    
    If Me.Combo1 = "Approved" Then
    
    Me.Combo2.Enabled = True
    Me.Combo2.Locked = False
    
    Else
    
    Me.Combo2.Enabled = False
    Me.Combo2.Locked = True
    
    End If
    
    Exit_Combo1_AfterUpdate:
        Exit Sub
    
    Err_Combo1_AfterUpdate:
        MsgBox Err.Description
        Resume Exit_Form_Current
    
    End Sub

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Quote Originally Posted by AccessLimited View Post
    I'm a pretty novice Access user so please help me. I'm trying to amend an existing Form by adding an Drop Down option "Approved" or "Not Approved". If Approved is selcted, they must move on to the next field which is also a drop down menu 1) Does meet criteria or 2)Not available. How do activate the second drop down only if the first one is Approved?

    I need to create this in design view, as apposed to actual coding, so can anyone help me figure out how to do this (in design view)?

    Thanks!
    In the form's OnLoad event, put the following line of code:
    Code:
    Me.CB2.Visible = False
    In CB1's AfterUpdate event, put the following code:
    Code:
    If Me.CB1.Value = "Approved" Then
        Me.CB2.Visible = True
        Me.CB2.SetFocus
    End If
    That should do it.

    Sam

  4. #4
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    Quote Originally Posted by Sam Landy View Post
    In the form's OnLoad event, put the following line of code:
    Code:
    Me.CB2.Visible = False
    In CB1's AfterUpdate event, put the following code:
    This isn't going to work if you are scrolling through records. You are going to come across records where CB2 has already been completed but you won't be able to see it, until you change CB1 again.

    You need to have the code on the Form Current event

    Code:
    If Me.CB1.Value = "Approved" Then
    Me.CB2.Visible = True
    Else
    Me.CB2.Visible = False
    End If
    Edit: But I conceed; your method of Visible vs Enabled & Locked is much better!

  5. #5
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Christyxo,

    I'm not too sure of your changes, for one reason. The form seems like it's only used for a one-time approval or not. In all probability, any record processed at that time is marked with a flag that it was processed, even if it's disapproved. Records that are displayed on the form are no doubt filtered to only display records that don't have this flag marked. A different form would then be used to filter those records and display (processed, unprocessed, or all) records, but without the ability to approve or disapprove. The form, as described by AccessLimited, would probably be used exclusively by management, as opposed to other forms accessing the same data.

    Of course if the above is not the case, bets are off.

    Sam
    Last edited by Sam Landy; 07-07-11 at 13:43. Reason: typo

Posting Permissions

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