Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform referencing

Status
Not open for further replies.

dlp

Programmer
Feb 14, 2000
2
AU
I have put a navigation button on a sub-form. This is the code behind the button:<br>
<br>
DoCmd.GoToRecord acDataForm, &quot;[Parent]![Child]&quot;, acLast<br>
<br>
Access will not accept the reference to the sub-form in this format: [Parent]![Child] <br>
<br>
Does anybody know what the correct terminalogy is???<br>
<br>
Thanks!
 
The syntax is: Forms![Parent form name]![Subform Control name].form<br>
But, I suggest avoiding the docmd method, and use the following:<br>
(frmOrders is 'parent' and sbfDetail is 'child')<br>
<br>
Dim rst As Recordset<br>
Set rst = Forms!frmOrders!sbfDetail.Form.RecordsetClone <br>
rst.MoveLast<br>
Forms!frmOrders!sbfDetail.Form.Bookmark = rst.Bookmark<br>
<br>
Notice that you must use the Name property of the subform *control*, not the name of the subform itself, ie, if you have a form &quot;sbfDetail&quot; and you drag it onto a main form, access will name the control the same as the subform, in which case you have no problem, but if you change the name of the control to &quot;Details&quot;, ie, keep in mind to use the control name, not the suform name: Forms!frmOrders!Details.form. You can also shorten the Forms!frmOrders! to Me! providing the event procedure is on the form itself.<br>
<br>
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top