Updating form1 when changes are made to form 2

Giganews Newsgroups
Subject: Updating form1 when changes are made to form 2
Posted by:  Luvin lunch (martina_mull…@o2.ie)
Date: 22 Aug 2006

Hi All,

I have a grid (i.e. continuous form) on Form1, that opens a second form
(not a subform) Form2 when the user double clicks on it.  On form2 the
user can save information.  When the user selects Save, I want to
reload Form1 because the changes in Form2 will change the order that
records should appear on Form1.  I have implemented this functionality
as follows:

Private Sub cmdSave_Click()
    If validData Then
        DoCmd.RunCommand acCmdSaveRecord
        DoCmd.Close acForm, "Form1"
        DoCmd.OpenForm "Form1"
        Me.SetFocus
    End If
End Sub

cmdSave is on Form2.  The code above causes the forms to change
position on the task bar which I would like to avoid.  Also, I think
it's just a bit rubbish.  Can anyone suggest a better way to get Form1
to reload when save is selected on Form2?

All help appreciated as Access is currently a complete mystery to me.

Thanks

MM

Replies