Conditional Hide Of Form Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KMEscherich
    New Member
    • Jun 2007
    • 69

    Conditional Hide Of Form Control

    Using Access '97

    Hi there, I have a form in which I am attempting to have a form control be hidden unless the CONTROL 1 = OTHER. This control is tied to a DROP-DOWN list and one of the options to select is OTHER.

    I have the following:

    Control 1 = SITE_LOC_CODE
    Control 2 = SITE_LOC_OTHER

    I need to have Control 2 be hidden unless OTHER is selected from CONTROL 1. At which time, I need to have Control 2 appear so someone can type in an entry.

    I have attached some code to see what I have done with CONTROL 1 and CONTROL 2.


    [CODE = VBA]
    Private Sub SITE_LOC_CODE_A fterUpdate()
    If Nz(Me.SITE_LOC_ CODE) = "" Then
    Me.SITE_LOC_OTH ER.Visible = False
    End If

    If Me.SITE_LOC_COD E = "OTHER" Then
    Me.SITE_LOC_OTH ER.Visible = True
    End If

    End Sub
    [/CODE]


    Thank you VERY MUCH for your assistance.
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by KMEscherich
    Using Access '97

    Hi there, I have a form in which I am attempting to have a form control be hidden unless the CONTROL 1 = OTHER. This control is tied to a DROP-DOWN list and one of the options to select is OTHER.

    I have the following:

    Control 1 = SITE_LOC_CODE
    Control 2 = SITE_LOC_OTHER

    I need to have Control 2 be hidden unless OTHER is selected from CONTROL 1. At which time, I need to have Control 2 appear so someone can type in an entry.

    I have attached some code to see what I have done with CONTROL 1 and CONTROL 2.


    [CODE = VBA]
    Private Sub SITE_LOC_CODE_A fterUpdate()
    If Nz(Me.SITE_LOC_ CODE) = "" Then
    Me.SITE_LOC_OTH ER.Visible = False
    End If

    If Me.SITE_LOC_COD E = "OTHER" Then
    Me.SITE_LOC_OTH ER.Visible = True
    End If

    End Sub
    [/CODE]


    Thank you VERY MUCH for your assistance.
    1. Invoke the property sheet for SITE_LOC_OTHER; set the visible property (default) to No
    2.
    Code:
    Private Sub SITE_LOC_CODE_AfterUpdate()
    If Nz(Me!SITE_LOC_CODE, "") = "" Then
           Me!SITE_LOC_OTHER.Visible = False
    ElseIf Me!SITE_LOC_CODE = "OTHER" Then
           Me!SITE_LOC_OTHER.Visible = True
    Else
           Me!SITE_LOC_OTHER.Visible = False
    End If
    
    End Sub

    Comment

    Working...