Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Cincinnati, Ohio
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use If/Then to set field visibility (2003)

    I have a form frmAssetInformation that upon loading sets two fields (ServertypeID and FunctionID) to visibile = false. On the form there is a combobox (cmboCategoryID). I am trying to set the servertype and serverfunction fields to visible = true if the value in cmboAssetType = "Server". I have the following in an after update event on cmboAssetType:
    **
    Private Sub cmboCategoryID_AfterUpdate()
    If Me.cmboCategoryID.Value = "Server" Then
    ServerTypeID.Visible = True
    FunctionID.Visible = True
    Else
    End If
    End Sub
    ****
    which is not working as I had hoped. Is this the right way to accomplish this? Any help would be appreciated. Thank you! - Scott

  2. #2
    Lounger
    Join Date
    Oct 2001
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use If/Then to set field visibility (2003)

    Try this:
    Private Sub cmboCategoryID_AfterUpdate()

    If cmboAssetType = "Server" Then
    Me.ServertypeID.Visible = True
    Me.FunctionID.Visible = True

    ElseIf cmboAssetType = "" Then
    Me.ServertypeID.Visible = False
    Me.FunctionID.Visible = False

    End If

    End Sub

    Make sure that your 2 fields are set to Visible "NO"

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Use If/Then to set field visibility (2003)

    I'm confused. What has cmboAssetType to do with this?

  4. #4
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Cincinnati, Ohio
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use If/Then to set field visibility (2003)

    Thank you. I made a small change to your work and now it does exactly what I had hoped:

    I used: [ElseIf cmboAssetType <> "Server" Then]
    Now if something other than a server is selected is returns to visible = false

    Thank you again for your help. - sb

  5. #5
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Cincinnati, Ohio
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use If/Then to set field visibility (2003)

    Typo in my post. Sorry for the confusion.

Posting Permissions

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