Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 04-17-2018, 05:54 AM   #1
chrisjames25
Newly Registered User
 
Join Date: Dec 2014
Posts: 227
Thanks: 3
Thanked 1 Time in 1 Post
chrisjames25 is on a distinguished road
How to requery a sub subform when close a different form

Hi. PReviously you guys have assisted me in requering a subform in a loaded form when i close another form. Works great.

For example i have MainForm with a SubMainform which lists different products. On the mainform there is an add button that pops up another form - AddForm.

When i close add form the following code is triggered on the addform:

Code:
Private Sub Form_Close()
   Const FN As String = "Mainform"
   If CurrentProject.AllForms(FN).IsLoaded Then Forms(FN).RequerySubforms
End Sub
Then within the main form there is the following code:

Code:
Public Sub RequerySubforms()
   Me.Child43.Requery
  
End Sub
This requeries my list in subform and the world is happy - until now.

I now have the situation where i have a:

Mainform
SubMainform
Sub-Submainform

My question is, how do i adapt my code to requery the sub-subform when i close the Addform.

Cheers in advance

chrisjames25 is offline   Reply With Quote
Old 04-17-2018, 06:17 AM   #2
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 5,051
Thanks: 120
Thanked 1,384 Times in 1,356 Posts
Minty has a spectacular aura about Minty has a spectacular aura about Minty has a spectacular aura about
Re: How to requery a sub subform when close a different form

I would bookmark this page http://access.mvps.org/access/forms/frm0031.htm as something you will refer to many, many times.

From there you need probably need
Me!Subform1.Form!Subform2.Form.requery
__________________
If we have helped;
Please click the 'reputation' scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is online now   Reply With Quote
Old 04-17-2018, 06:23 AM   #3
chrisjames25
Newly Registered User
 
Join Date: Dec 2014
Posts: 227
Thanks: 3
Thanked 1 Time in 1 Post
chrisjames25 is on a distinguished road
Re: How to requery a sub subform when close a different form

Worked like a charm Minty.

All bookmarked now.

Many thanks for speedy response.

chrisjames25 is offline   Reply With Quote
The Following User Says Thank You to chrisjames25 For This Useful Post:
Minty (Yesterday)
Old 04-17-2018, 06:46 AM   #4
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 4,448
Thanks: 71
Thanked 1,089 Times in 1,017 Posts
ridders is a jewel in the rough ridders is a jewel in the rough ridders is a jewel in the rough ridders is a jewel in the rough
Re: How to requery a sub subform when close a different form

Was this for your navigation form & if so is it now AOK?
__________________
Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left and leave a comment.

New example databases:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
ridders is offline   Reply With Quote
Old 04-17-2018, 10:36 AM   #5
chrisjames25
Newly Registered User
 
Join Date: Dec 2014
Posts: 227
Thanks: 3
Thanked 1 Time in 1 Post
chrisjames25 is on a distinguished road
Re: How to requery a sub subform when close a different form

Hi Ridders.

Following your advice yesterday i abandoned the nav form and built my own which now works just like the nav form but with my limited knowledge is proving easier for me to crack on with and keep developing my stock system.
chrisjames25 is offline   Reply With Quote
Old 04-17-2018, 10:42 AM   #6
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 4,448
Thanks: 71
Thanked 1,089 Times in 1,017 Posts
ridders is a jewel in the rough ridders is a jewel in the rough ridders is a jewel in the rough ridders is a jewel in the rough
Re: How to requery a sub subform when close a different form

Congratulations.
In the end, you are probably better off creating your own form with the look and feel of the navigation form but without its idiosyncrasies.

The other 'ready made' form I recommend you avoid is the split form

Keep on 'cracking on'

__________________
Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left and leave a comment.

New example databases:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
ridders is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using VBA to Close Form After Requery Reese Modules & VBA 25 03-08-2016 10:11 AM
Requery form and subform after pop-up form close bigalpha Forms 2 08-19-2013 09:27 AM
[SOLVED] Update/requery subform through on close event of another form brharrii Forms 5 08-02-2013 12:37 PM
Requery on close of form james_halliwell General 7 03-09-2010 09:27 AM
Using .Requery on a form which got a subform, with another subform in it *headache* Mirador Forms 3 03-17-2004 01:35 PM




All times are GMT -8. The time now is 05:49 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World