• Hide Subform from seperate subform (2002 SP3)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Hide Subform from seperate subform (2002 SP3)

    Author
    Topic
    #450065

    I have a main form with two separate sub forms. I would like to hide or show the second sub form from criteria in the first sub form. The code is from the first sub forms Current event. The main form is called frm_die_tag and the two sub forms are called zfrm_die_tags_1 and zfrm_die_tags_2. The zfrm_die_tags_2 is the one I am trying to hide or show.

    Here is a snippet of code I am using.
    Private Sub Form_Current()
    If Me.die_tag_uom < 0 Then
    Form_frm_die_tag.zfrm_die_tags_2.Visible = True
    Else
    Form_frm_die_tag.zfrm_die_tags_2.Visible = False
    End If
    End Sub

    Thanks,

    Viewing 0 reply threads
    Author
    Replies
    • #1104986

      Try

      Private Sub Form_Current()
      Me.Parent!zfrm_die_tags_2.Visible = (Me.die_tag_uom < 0)
      End Sub

      zfrm_die_tags_2 should be the name of the second subform as a control on the main form. This is not necessarily the same as the name of the subform in the database window. Open the main form in design view and click once on the second subform to see its control name.

      You may want to call the same line in the After Update event of the die_tag_uom control.

      • #1104998

        I did use the name of the controls for the subforms as they are shown on the main form. This did not work either. I have tried what I have posted along with a few other ideas I found but no luck so far. I will try to do some more research tonight when I get home from work

        Thanks,

        • #1105001

          If you wish, you can post a stripped down copy of your database. See post 401925 for instructions.

          • #1105020

            This is a very basic stripped down version of the database.

            • #1105026

              The code does work, but there are no records with die_tag_uom < 0 so it doesn't get a chance to prove it.

              Why aren't the subforms linked to the main form? In the attached version, I have assumed that both subforms should be linked to the main form on the die_tag field.
              I have added code to show/hide the second subform when the value of die_tag_uom in the first subform has been changed.

            • #1105028

              Thanks, I have been in such a hurry to finish this project I overlooked that simple qualifier. The whole time it should have been less than 1. I am sorry for taking up your time. I should have caught that this morning. I feel so embarrassed right now. blush I knew this should have been something simple. thankyou

            • #1105030

              No prob, we all make mistakes like that…

    Viewing 0 reply threads
    Reply To: Hide Subform from seperate subform (2002 SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: