Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    finding the right event (A2002)

    When I open Form A from another form I would like the header to disappear on Form A. When I leave the current record on Form A I would like the header to reappear.

    No problems with the first part. However, I used the BeforeUpdate event to trigger the reappearance of the header. So, when the only change on Form A is to the data on the subform, when I move to a new record the header does not reappear.

    Can someone point me toward the right event to use for my purposes?

    Eli

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

    Re: finding the right event (A2002)

    Hi Elizabeth,

    You could do the following:
    <UL><LI>Put a check box chkSubChanged somewhere on the main form (formA); set its Visible property to No.
    <LI>Set this check box to True in the After Update event of the subform:

    Private Sub Form_AfterUpdate()
    Me.Parent.chkSubChanged = True
    End Sub

    <LI>Test the check box in the On Current event of the main form (formA):

    Private Sub Form_Current()
    If Me.chkSubChanged = True Then
    Me.FormHeader.Visible = True
    End If
    End Sub[/list]If something has changed in the subform, the check box will be set to True; when the user moves to another record in the main form, the form header will be made visible.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Cedar Falls, Iowa, USA
    Posts
    268
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: finding the right event (A2002)

    Hans,

    Great fix. Got one more question. Now when I switch from the main form to enter information on the subform the header becomes visible. I don't want it visible until I open a new record. Can you suggest a good strategy?

    Thanks for your ongoing input...it sure helps.

    E

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

    Re: finding the right event (A2002)

    You could extend the technique from the sub form to the main form. In the After Update event of the main form, set the check box to True instead of making the header visible:

    Private Sub Form_AfterUpdate()
    Me.chkSubChanged = True
    End Sub

    (there is no .Parent this time, because this is the After Update event of the main form itself)

    You don't need to change the On Current event. It will now display the header on the main form when the user moves to a new record.

    Remark: if the user moves to a new record without having changed anything in the mainform or subform, the header will remain invisible. If you want to make it visible under all circumstances, just set Me.FormHeader.Visible = True in the On Current event, without an If ... Then ... End If.

Posting Permissions

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