Enable 2 fields based on the drop down selection of another field

J

julostarr

Access 2003

I am trying to find a code for a form to base the edit ability of 2
different dropdown list fields based on the choice of another dropdown list
field.


Example:

Drop Down 1 Drop Down 2 Drop Down 3
1. Choice 1
2. Choice 2
3. Choice 3


Before editing the record Drop Down 2 and Drop Down 3 would be disabled for
editing. Selecting Choice 1 in Drop Down 1 would enable only Drop Down 2 to
be edited. Selecting Choice 2 would enable only Drop Down 3 to be editable.
Choice 3 would leave both Drop Down 2 & 3 disabled for editing.

Can anyone help me with this?
 
D

Douglas J. Steele

In the form's Current event, disable DropDown2 and DropDown3:

Private Sub Form_Current()

Me.DropDown2.Enabled = False
Me.DropDown3.Enabled = False

End Sub

In the AfterUpdate event of DropDown1, check the value selected:

Private Sub DropDown1_AfterUpdate()

Select Case Me.DropDown1
Case "Choice 1"
Me.DropDown2.Enabled = True
Me.DropDown3.Enabled = False
Case "Choice 2"
Me.DropDown2.Enabled = False
Me.DropDown3.Enabled = True
Case "Choice 3"
Me.DropDown2.Enabled = False
Me.DropDown3.Enabled = False
End Select

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top