Requery Subform (2 Viewers)

mike60smart

Registered User.
Local time
Today, 07:03
Joined
Aug 6, 2017
Messages
1,905
Hi Everyone
For some reason I cannot get the following to work.

I have a Main Form named "frmQuotes"
On the Main Form I have Sub1 named "frmQuoteElementsSubform"
When I run an On Click Event from Sub1 I need to refresh Sub2 on the Main Form

The name of Sub2 is "frmProfileOrdersSubform"

I have tried the following with no success:-

[Forms]![frmQuotes].[frmProfileOrderssubform].[Form].Requery

[Forms]![frmQuotes]![frmProfileOrderssubform].Requery

[Forms]![frmQuotes]![frmQuoteElementsSubform]![frmProfileOrderssubform].[Form].Requery

Any help appreciated.
 

XPS35

Active member
Local time
Today, 08:03
Joined
Jul 19, 2022
Messages
159
I guess it starts with me.parent..........
 

moke123

AWF VIP
Local time
Today, 02:03
Joined
Jan 11, 2013
Messages
3,920
Code:
Parent.Form.frmProfileOrderssubform.Form.Requery

I would throw in a me.dirty = false just for good measure
 

mike60smart

Registered User.
Local time
Today, 07:03
Joined
Aug 6, 2017
Messages
1,905
Code:
Parent.Form.frmProfileOrderssubform.Form.Requery

I would throw in a me.dirty = false just for good measure
Hi Moke
Thanks for looking but again it does not work.
 

moke123

AWF VIP
Local time
Today, 02:03
Joined
Jan 11, 2013
Messages
3,920
Works for me.
 

Attachments

  • ReqSub.accdb
    484 KB · Views: 28

Josef P.

Well-known member
Local time
Today, 08:03
Joined
Feb 2, 2023
Messages
826
A little more complex but without dependencies:
Sub1 raise event "QuoteElementXXX" -> main form listens to the event -> and main from call requery of Sub2
 

Edgar_

Active member
Local time
Today, 01:03
Joined
Jul 8, 2023
Messages
430
Before attempting different syntax options, just check your reference works. Verify if something like [Forms]![frmQuotes].[frmProfileOrderssubform].[Form].Name works for your case. If it does, there's no need to explore other syntax options, simply use Requery after the reference. If your reference does not work, then modify it.

If Requery doesn't produce the expected results, investigate the data's behavior. Make a change from the form, open the relevant table and ensure the change is there. If no changes are there, commit the record with Me.Dirty = False and test for modifications by opening the table again. If there are still no changes, induce a modification directly in the table. If this alteration doesn't reflect in the form, verify your data source is correct. If the form updates correctly, confirm that you're genuinely modifying the data. Repeat this process as needed.
 
Last edited:

mike60smart

Registered User.
Local time
Today, 07:03
Joined
Aug 6, 2017
Messages
1,905
Hi Everyone

My apologies for the late reply.

This actually works:

Code:
[Forms]![frmQuotes]![frmProfileOrderssubform].Requery

The problem was down to me as the subform was based on 2 tables.

Removed the other table and now works fine.

Many thanks for looking.
 

Users who are viewing this thread

Top Bottom