X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Can't Requery Subform, Access 2010    
post Aug 10 2018, 07:07 AM

Posts: 629
Joined: 12-November 02

I currently open 'Form B' in 'Add' mode from a button on 'Form A'. I use 'Form A' to add persons to a list.
When I close 'Form B' and redisplay 'Form A' I want to re-query a sub-form on 'Form A' that lists the names of the persons added on 'Form B'.

How can this be done.

Go to the top of the page
post Aug 10 2018, 07:38 AM

UtterAccess VIP
Posts: 7,827
Joined: 24-May 10
From: Downeast Maine

Have you tried Forms!FormA!SubformControlName.Form.Requery? You could run it from FormB, but I don't know where exactly to suggest placing the code since there is so little detail. Maybe the Close event (assuming it is a dialog form that needs to be closed before anything else can be done).
Go to the top of the page
post Aug 10 2018, 07:48 AM

Posts: 924
Joined: 12-November 03
From: Iowa Lot

Have you considered adding the new person directly to the subform rather than using a separate form?
Go to the top of the page
post Aug 10 2018, 07:59 AM

UA Admin
Posts: 34,587
Joined: 20-June 02
From: Newcastle, WA

I also suspect you might simplify the process by adding new people directly in the subform.

On the other hand, if you must use a pop up form, then you can do this:

Private Sub cmdOpenFormBForInput()

    DoCmd.OpenForm formName:="FormB", view:=acNormal, Datamode:=acFormEdit, windowmode:=acDialog
    With Me
    End With

End Sub

Opening FormB as a modal (i.e. windowmode:=acDialog) suspends the code. When FormB closes, then processing resumes and the subform is requeried.

This post has been edited by GroverParkGeorge: Aug 10 2018, 08:01 AM
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    23rd February 2019 - 08:14 AM