[AccessD] Refreshing a form

Rocky Smolin rockysmolin2 at gmail.com
Sat Dec 10 16:44:24 CST 2022


This is what I ended up with:

If isFormLoaded("frmMaintenanceDashboard") = True Then
        Call Forms("frmMaintenanceDashboard").cmdRefresh_Click
    End If

Since the form - frmTasks - can be opened in two places, I had to check to
see if frmMaintenanceDashboard was loaded.

The whole module looks like this:

Private Sub cmdExit_Click()

    DoCmd.Close
    If isFormLoaded("frmTaskListAll") = True Then
        Forms!frmTaskListAll.Form.Requery
    End If

    If isFormLoaded("frmMaintenanceDashboard") = True Then
        Call Forms("frmMaintenanceDashboard").cmdRefresh_Click
    End If

End Sub

The module cmdRefresh_Click has more than just a refresh command:

Public Sub cmdRefresh_Click()
    DoCmd.RunCommand acCmdSaveRecord

    Call MakeMaintenanceDashboardTable

    Me.Requery
    Me.cmdExit.SetFocus

End Sub

So I had to make the module Public and call it.  But all works a treat now.

Thanks to all

Rocky





On Fri, Dec 9, 2022 at 9:38 PM Bill Benson <bensonforums at gmail.com> wrote:

> This is what I do as well
>
> On Fri, Dec 9, 2022 at 1:43 PM Rocky Smolin <rockysmolin2 at gmail.com>
> wrote:
>
> > The other way I've done this is to close the calling form and then open
> the
> > calling form from the calle form. The refresh has to occur as part of the
> > _Open event, though. But that seems a bit kludgey.
> >
> > r
> >
> > On Fri, Dec 9, 2022 at 10:39 AM Ryan W <wrwehler at gmail.com> wrote:
> >
> > > Welp. I think I was partially correct.  That works for modal forms but
> > not
> > > your normal forms.... duh!
> > > .
> > >
> > > On Fri, Dec 9, 2022 at 12:34 PM Ryan W <wrwehler at gmail.com> wrote:
> > >
> > > > The other way I've done it.. IIRC is if you have a button to open the
> > > task
> > > > form ln the dashboard:
> > > >
> > > >
> > > > Private sub btn_Click()
> > > >    docmd.Openform "TaskFrm"
> > > >    call RefreshRoutine
> > > > end sub
> > > >
> > > >
> > > > IIRC, your code after the openform command shouldn't run until the
> form
> > > > closes.
> > > >
> > > > On Fri, Dec 9, 2022 at 12:28 PM Rocky Smolin <rockysmolin2 at gmail.com
> >
> > > > wrote:
> > > >
> > > >> Yeah, that's the simple way to do it. I'll do it that way.
> > > >>
> > > >> Thanks
> > > >>
> > > >> Rocky
> > > >>
> > > >>
> > > >> On Fri, Dec 9, 2022 at 10:23 AM Ryan W <wrwehler at gmail.com> wrote:
> > > >>
> > > >> > In the Form_Close event on the task form you can do something
> like:
> > > >> >
> > > >> > Dim frm as new Form_DashBoardFrm
> > > >> > frm.RefreshRoutine (as long as a public method)
> > > >> > set frm = nothing
> > > >> >
> > > >> > or maybe even just Forms!DashBoardFrm.RefreshRoutine
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> > On Fri, Dec 9, 2022 at 12:16 PM Rocky Smolin <
> > rockysmolin2 at gmail.com>
> > > >> > wrote:
> > > >> >
> > > >> > > Dear List:
> > > >> > >
> > > >> > > I have a dashboard form from which the user can select a task
> > which
> > > >> opens
> > > >> > > up a task form. Having made changes to the task form and closing
> > > it, I
> > > >> > > would like the dashboard form to reflect those changes.
> > > >> > >
> > > >> > > I have a refresh routine in the dashboard form's module and a
> > > >> temporary
> > > >> > > button on the dashboard to refresh the form.  I suppose I could
> > call
> > > >> the
> > > >> > > refresh routine in the dashboard from the task form, but I'm
> > > >> wondering if
> > > >> > > there is an event which fires when the task form closes and the
> > > >> dashboard
> > > >> > > gets the focus but I haven't found one that will do that.
> > > >> > >
> > > >> > > Is there one? Or must I call the refresh routine in the
> dashboard
> > > >> from
> > > >> > the
> > > >> > > task form.
> > > >> > >
> > > >> > > MTIA
> > > >> > >
> > > >> > > Rocky
> > > >> > > --
> > > >> > > AccessD mailing list
> > > >> > > AccessD at databaseadvisors.com
> > > >> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > >> > > Website: http://www.databaseadvisors.com
> > > >> > >
> > > >> > --
> > > >> > AccessD mailing list
> > > >> > AccessD at databaseadvisors.com
> > > >> > https://databaseadvisors.com/mailman/listinfo/accessd
> > > >> > Website: http://www.databaseadvisors.com
> > > >> >
> > > >> --
> > > >> AccessD mailing list
> > > >> AccessD at databaseadvisors.com
> > > >> https://databaseadvisors.com/mailman/listinfo/accessd
> > > >> Website: http://www.databaseadvisors.com
> > > >>
> > > >
> > > --
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list