Avatar of chestera
chestera
 asked on

Sub forms

Hi EE

I am having problems requery Sub forms. I have tried Forms![Form]![FormSub].Requery
Not sure what I am missing
Any help appreciated

chestera
Microsoft Access

Avatar of undefined
Last Comment
chestera

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
IrogSinta

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
chestera

ASKER
IrogSinta

The main form holds the sub form

Me.frmLoanAdjustmentSubControl.form.Requery

When I run I get the message "Method or Data member not found". Do I some how have to link the two forms

Alan
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Be SURE you are using the Name of the Sub Form Control on the Main form, not the name of the actual Form that is being used as a subform. This applies when the Source Object (actual Form object being used as the subform) ... and the Name property on the Subform Control are different.  Use what is in the Name Property.  By default they are the same, BUT ... that may not be the case here.

mx
chestera

ASKER
DatabaseMX

The situation is I have the main form frmLoanAdjust and on that form a Sub form frmLoanAdjustSub
I have code behind a button on the main form which makes changes to the table linked to the subform. After making changes I would like the sub form to reflect those changes by a Requery. I am a bit confused between name of the subform control and the actual subform name.

Alan
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
SOLUTION
Scott McDaniel (EE MVE )

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Hamed Nasr

Alan,
I am a bit confused between name of the subform control and the actual subform name.

Assume you have 2 forms, named in navigation pane as:  mForm, and sForm

If you drage sForm into mForm, while open in design mode, you notice a control with it's type is SubFrom/SubReport with a name sForm.  This is the name of the actual subform, but access, by default names the control with the dragged from, which happens to be sForm.

You may change this name to any other name.
Looking into the properties sheet of the sForm Subform control Data Tab > Source Object: sForm

From here comes the confusion of using the same name.

The name of the actual subform is not used in referencing objects. The name you see is the name given to the SubForm object.
mForm is referred to as: Forms!mForm
sForm is referred to as: Forms!mForm!sForm.Form

Here sForm is the name of the Subform control that holds the actual form. The actual form name is not directly written, it is referred to by adding .Form

If you change the Subform control name after dragging sForm to main form, and rename it to mySubForm
Then:
sForm is referred to as: Forms!mForm!mySubForm.Form

Only .Form refers to the actual sForm in the navigation pane.

Hope that helps clearing confusion.
The actual subform name as it appears in navigation pane is not used in referring to actual subform or its controls, only .Form is added to the Subform control to allow access to the actual form and its controls.
chestera

ASKER
hnasr

Thank you very much that clears that problem up I now fully understand

Alan
chestera

ASKER
Scott McDaniel

Thank you Scott Excellent explanation

Alan
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
chestera

ASKER
Thank you every one for all your help
SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Scott McDaniel (EE MVE )

Seems to me the correct answer and syntax was the first post by Ron ... and some credit s/b given as such :-)
Agreed.
chestera

ASKER
Scott McDaniel

Totaly agree my error can I rectify this

Alan
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
chestera

ASKER
irogsinta

My apologies for not giving you points or even thanking you for you support.
Bottom line I now have it working and have a better understanding of Sub forms

Alan
IrogSinta

No worries.  The other experts gave you detailed explanations that ultimately helped you work out your problem.  We're all here to help.

Ron
chestera

ASKER
IrogSinta

Thank you for your understanding Ron. I will be more careful in future

Alan
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
chestera

ASKER
Hi

I have been asked to close the question I thought I already did this by awarding points  but here goes again :)

Alan