Show/Hide fields in Access 2007

Closed
Ryan - Jun 17, 2010 at 06:43 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jun 17, 2010 at 10:30 AM
Hello,

Can anyone help me figure out how to show/hide fields based on information entered in other fields in a form in Access 2007? What I'm looking to do is: When a selection from a drop down is chosen, hidden Yes/No fields (check boxes) that apply to that specific information appear and can be updated by users. The other Yes/No fields that do not apply to the chosen selection remain hidden.

I need to be able to do this for all the individual records in the form, but I'm having trouble figuring out how to do that.

I used the code below (as an example) in the After Update event of my drop down field to try to do this, but a.) I want all the yes/no fields hidden until a drop down selection is made and this doesnt do that and b.) it worked at hiding the inapplicable fields, but it hid those fields for all the other records and I couldnt get them back:

Private Sub Disposition_AfterUpdate()
Select Case cboRecordType
Case "Selection 1"
Me.[Field1].Visible = True
Me.[Field2].Visible = False
Me.[Field3].Visible = False
Me.[Field4].Visible = False
Case "Selection 2"
Me.[Field1].Visible = False
Me.[Field2].Visible = True
Me.[Field3].Visible = False
Me.[Field4].Visible = False
Case "Selection 3"
Me.[Field1].Visible = False
Me.[Field2].Visible = False
Me.[Field3].Visible = True
Me.[Field4].Visible = False
Case Else
Me.[Field1].Visible = False
Me.[Field2].Visible = False
Me.[Field3].Visible = False
Me.[Field4].Visible = True
End Select
End Sub

Any help would be very much appreciated because trying to figure this out is driving me nuts :)

Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 17, 2010 at 10:30 AM
I think you need to use change() event

Private Sub Combo0_Change()

End Sub
0