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.
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
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
The main form holds the sub form
Me.frmLoanAdjustmentSubCon
When I run I get the message "Method or Data member not found". Do I some how have to link the two forms
Alan