Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Anderson, Indiana, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hide Subform from seperate subform (2002 SP3)

    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,

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

    Re: Hide Subform from seperate subform (2002 SP3)

    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.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Anderson, Indiana, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Subform from seperate subform (2002 SP3)

    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,

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

    Re: Hide Subform from seperate subform (2002 SP3)

    If you wish, you can post a stripped down copy of your database. See <post#=401925>post 401925</post#> for instructions.

  5. #5
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Anderson, Indiana, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Subform from seperate subform (2002 SP3)

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

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

    Re: Hide Subform from seperate subform (2002 SP3)

    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.
    Attached Files Attached Files

  7. #7
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Anderson, Indiana, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Subform from seperate subform (2002 SP3)

    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. <img src=/S/blush.gif border=0 alt=blush width=15 height=15> I knew this should have been something simple. <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

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

    Re: Hide Subform from seperate subform (2002 SP3)

    No prob, we all make mistakes like that...

Posting Permissions

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