Open a form when another form is updated

  • Thread starter Thread starter shaggles
  • Start date Start date
S

shaggles

I'm working with an Access 97 db that I inherited from a
previous admin. It requires 2 forms to be updated with
the same information. I want to make form B open
automatically after form A is updated and closed. I don't
want it to open everytime someone closes form A (the form
is used for viewing information as well as entering) or
after every update to form A (there are frequently
multiple updates) so I thought something like this would
work:
Private Sub Form_Close()

On Error GoTo Err_Form_On_Close

Dim DocName As String
Dim LinkCriteria As String
DocName = "Form_B"
LinkCriteria = "[SS#] = Forms!Form_A![SS#]"
If Me.Dirty Then

DoCmd.OpenForm DocName, , , LinkCriteria
End If


Exit_Form_On_Close:
Exit Sub

Err_Form_On_Close:
MsgBox Error$
Resume Exit_Form_On_Close


End Sub
 
Hi,
I'm not sure I follow you're logic as to when form b should be opened,
but you can try something like this.

Declare a boolean variable in the declarations section of your form,
that is, at the top before any subs or events. Let's call it bDirty.

Set it to true in the After Update event of your form. Then in the close event:
If bDirty Then
.........

See if that works for you.
 
Back
Top