[AccessD] Refer to a control on parent form from subform

William Benson (VBACreations.Com) vbacreations at gmail.com
Tue Apr 17 16:12:40 CDT 2012


Me.sbfrmItemIncentive.Form.Recordset = "stpItemIncentive"

Recordsource?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee
Sent: Tuesday, April 17, 2012 1:40 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Refer to a control on parent form from subform

You can always call it in this manner:
Forms!frmMainForm!!sbfrmName!txtSomeField

Or this way:

Me.Parent.txtSomeField = "SomeValue"
or
strSomeVariable = Me.Parent.txtSomeField

Me.sbfrmMySubForm.Form.txtIncDetID = 0
or
Me.sbfrmMySubForm.txtIncDetID = 0



I've used this in ADPs:

Me.sbfrmItemIncentive.Form.Recordset = "stpItemIncentive"

to requery:
Me.sbfrmSalesDetailByInvoiceNo.Form.Requery




On Tue, Apr 17, 2012 at 9:38 AM, Arthur Fuller
<fuller.artful at gmail.com>wrote:

> Actually I need to do it both ways.
>
> On the subform I need to refer to the value of a control on the parent
> form.
> On the parent form I need to set the recordsource of the subform.
>
> I've forgotten the Access 2000 (SP3) syntax.
>
> TIA,
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list