Displaying a Cell

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dollarstar
    New Member
    • Mar 2008
    • 8

    #1

    Displaying a Cell

    I need a field on a form to display if three out of the four options are displayed.

    So i have:

    Option 1
    Option 2
    Option 3
    Option 4

    If Option 2 to 4 is selected in the combo box then display field 2

    I've tried to code it myself but it doesnt like it and I don't know enough to keep guessing at it.

    Code:
    Private Sub BuildingReg_AfterUpdate()   
    If Me.BuildingReg.Column(X) = "N/A" Then  
    Me.BuildingRegSubmit.Visable = False  
    Else  
    Me!BuildingRegSubmit.Visable  
    End If 
    End Sub
    I think its completely wrong but anyhoo and help/insight would be greatly appreciated.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    This code is generic in that it makes no difference whatsoever what the Options in the Combo Box are named, it simply goes by their absolute position. If Options 2, 3, or 4 are chosen, then Field 2 will become visible, otherwise it will be invisible. Should you change the number of Options, or the manner in which Field 2 is displayed, the code must be changed. Make sure you place this in the AfterUpdate() Event of the Combo Box:
    Code:
    Private Sub BuildingReg_AfterUpdate()
    Select Case Me![BuildingReg].ListIndex
      Case 1 To 3
        Me.BuildingRegSubmit.Visible = True
      Case Else
        Me.BuildingRegSubmit.Visible = False
    End Select
    End Sub

    Comment

    Working...