Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting visibility programatically on a form (2K)

    <img src=/S/jollyroger.gif border=0 alt=jollyroger width=29 height=18>



    I have a form, that is to say i am creating a form, that will be a summarry of a query. It will be a matrix of sorts (a continuous form), with part number, customer, and location fields, but also, lables formated with different colors, for different results of the underlying query such as Not Required, Not Completed, and Completed. On other forms I have done this by placing the labels on top of each other and setting their .visibility using a series of If-Then's. Here is the code I can't get to work:

    rivate Sub Form_Load()

    'Sets FCR state
    If Me.TbxFCRDesc.Value = Null Then
    Me.LblFCRNotReq.Visible = True
    Me.LblFCRNotComp.Visible = False
    Me.LblFCRComp.Visible = False
    Else
    If Me.TbxFCRComp.Value = Null Then
    Me.LblFCRNotReq.Visible = False
    Me.LblFCRNotComp.Visible = True
    Me.LblFCRComp.Visible = False
    Else
    Me.LblFCRNotReq.Visible = False
    Me.LblFCRNotComp.Visible = False
    Me.LblFCRComp.Visible = True
    End If
    End If

    End Sub

    FCR (finger concept review) is one of several Reviews to have colmumns on this continuous form, and it is this continouos setting that I think i have a problem, but I am unsure of how to proceed. What am I missing?

    Thanks for your time.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Setting visibility programatically on a form (

    Two suggestions

    Try replacing each me. with me!
    <pre> If Me.TbxFCRDesc.Value = Null Then </pre>

    becomes

    <pre>If Me!TbxFCRDesc.Value = Null Then</pre>


    Secondly test if your conditions are ever satisfied by putting message boxes in your code: e.g.
    <pre> If Me!TbxFCRDesc.Value = Null Then
    msgbox("TbxFCRDesc is null")
    </pre>

    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Setting visibility programatically on a form (2K)

    Understand that you actually only have one set of controls on a continuous form, so setting visibilty the way you're trying to do it won't adapt itself to the individual records in a continuous form. When you refer to Me.ControlName or Me!ControlName (and by the way, either syntax works), you're referring to the only instance of that control on the form, even though it may appear as many times as you have records visible. So changing the visibility of a label is going to apply to all records in a continuous form, even those that don't meet the same criteria.
    Charlotte

  4. #4
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting visibility programatically on a form (2K)

    Charlotte,
    Thanks - I suspected this may be an issue. Is there any way around this? or should I find a different method for displaying the data?

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

    Re: Setting visibility programatically on a form (2K)

    Instead of a series of labels on top of each other, use a single text box with a control source that uses IIf's to determine what to display. You can use conditional formatting to change the font color. Since the content of the text box is dependent on the record source of the form, it will be different from record to record.

  6. #6
    Star Lounger
    Join Date
    Jul 2003
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting visibility programatically on a form (2K)

    I'll try that - sounds like a beauty. thanks for the help!!!

Posting Permissions

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