[AccessD] Main form requery help needed

David McAfee davidmcafee at gmail.com
Mon Oct 29 13:25:13 CDT 2012


You can open the person information form in modal/acdialog model with the
next line that requeries:

Docmd openform "frmPersonInfo", , , , , acDialog
me.requery


or you can do the following in the OnClose event of frmPersonInfo:


If IsLoaded(frmHousehold) then forms!frmHousehold.sfrmPeople_in_HH.Requery

I have Isloaded in a module:

Function IsLoaded(ByVal strFormName As String) As Boolean
 ' Returns True if the specified form is open in Form view or Datasheet
view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
        If Forms(strFormName).CurrentView <> conDesignView Then
            IsLoaded = True
        End If
    End If
End Function

HTH
David McAfee

On Mon, Oct 29, 2012 at 10:19 AM, Tina Norris Fields <
tinanfields at torchlake.com> wrote:

> Hi,
>
> I have a main form for households, with a subform showing the people in
> the given household.  When I want to add a person to the household, I click
> a button to open the person information form in add mode.  When I close the
> person information form, I want the main form to requery and update the
> subform.  If I close the main form and reopen it, the subform is updated,
> but I would prefer it to update without the main form having to be closed
> and reopened.
>
> I thought that I could make use of the main form's "On Current" event sort
> of like this:
>
> Private Sub Form_Current()
>     Forms![frmHousehold]!**sfrmPeople_in_HH.Form.Requery
> End Sub
>
> This does not work.  So, I am doing something wrong and I don't see what
> it is.  Asking for other eyes to look at it.
>
> Main form is named frmHousehold.  The subform control is named
> sfrmPeople_in_HH.
>
> What am I doing wrong?
>
> Tina
>
> --
> Tina Norris Fields
> tinanfields at torchlake.com
> 231-322-2787
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/**mailman/listinfo/accessd<http://databaseadvisors.com/mailman/listinfo/accessd>
> Website: http://www.databaseadvisors.**com<http://www.databaseadvisors.com>
>


More information about the AccessD mailing list