From: TL on
Receiving "Run-Time Error 2452 - Expression you have entered has an invalid
reference to the Parent property"

Review of my design

EquipmentDataTable (LOTOGroup field) -> EquipmentType (Query with LOTOGroup
field) -> EquipmentFrm (mainform) - which has the LOTOGroup field (Combobox
with a Row Source of "SELECT [LOTO Table].[LOTOGroups] FROM [LOTO Table]
ORDER BY [LOTOGroups];"

LOTOTable (LOTOGroups field) -> LOTOFrmADD (subform) - which has the
LOTOGroups field with the On Update code of the form set to
"Me.Parent!LOTOGroup.Requery"

I open the LOTOAddFrm (subform) from the EquipmentFrm (mainform) via a
command button with the following code:

Private Sub Command24_Click()
On Error GoTo Err_Command24_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "LOTOFrmAdd"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command24_Click:
Exit Sub
Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click
End Sub

What am I Missing?

"Armen Stein" wrote:

> On Wed, 24 Mar 2010 12:28:01 -0700, TL <TL(a)discussions.microsoft.com>
> wrote:
>
> >What I am trying to do is update (requery?) a main form combo box after
> >entering data into a subform combo box?
>
> Okay. Try:
>
> Me.Parent!LOTOGroup.Requery
>
> This will requery the entries in the dropdown list for that combobox.
> It will NOT change the current value of the item selected in the
> combobox, if any.
>
> >What I previously sent was the code that was placed into the subform's
> >update section.
>
> That seems to be the right place, but again, we can't see everything
> you have.
>
> >Will the "Me.Parent!LOTOGroup = Me.MyControlOnThisSubform" do this?
>
> No. It would change the VALUE of the combobox on the main form, which
> is what I thought you were trying to do.
>
> >Is the "Parent" section of this code supposed to the name of the mainform,
> >or remain as parent?
>
> My (and many others') convention is to prefix anything that needs to
> be changed to *your* naming with "My". However, in this case Parent
> is a property of an Access form that refers to the form that contains
> it. It can even go further - Me.Parent.Parent refers to a subform's
> Parent's Parent form. (Grandparent :)
>
> Armen Stein
> Microsoft Access MVP
> www.JStreetTech.com
>
> .
>
From: John W. Vinson on
On Thu, 25 Mar 2010 04:43:02 -0700, TL <TL(a)discussions.microsoft.com> wrote:

>LOTOTable (LOTOGroups field) -> LOTOFrmADD (subform) - which has the
>LOTOGroups field with the On Update code of the form set to
>"Me.Parent!LOTOGroup.Requery"

Are you just typing that in the On Update property? If so, change it to [Event
Procedure] and edit it into the VBA code for the event.
--

John W. Vinson [MVP]
From: TL on
I am going into the LOTTOFrmADD form's Properties, Event Tab, After Update
code and typing the code in their?

"John W. Vinson" wrote:

> On Thu, 25 Mar 2010 04:43:02 -0700, TL <TL(a)discussions.microsoft.com> wrote:
>
> >LOTOTable (LOTOGroups field) -> LOTOFrmADD (subform) - which has the
> >LOTOGroups field with the On Update code of the form set to
> >"Me.Parent!LOTOGroup.Requery"
>
> Are you just typing that in the On Update property? If so, change it to [Event
> Procedure] and edit it into the VBA code for the event.
> --
>
> John W. Vinson [MVP]
> .
>
From: John W. Vinson on
On Mon, 29 Mar 2010 04:33:01 -0700, TL <TL(a)discussions.microsoft.com> wrote:

>I am going into the LOTTOFrmADD form's Properties, Event Tab, After Update
>code and typing the code in their?

No.

Click on the ... icon next to the box, and choose Code Builder. This will open
the VBA editor. Write the code there.
--

John W. Vinson [MVP]
From: TL on
That is exactly what I am doing.

"John W. Vinson" wrote:

> On Mon, 29 Mar 2010 04:33:01 -0700, TL <TL(a)discussions.microsoft.com> wrote:
>
> >I am going into the LOTTOFrmADD form's Properties, Event Tab, After Update
> >code and typing the code in their?
>
> No.
>
> Click on the ... icon next to the box, and choose Code Builder. This will open
> the VBA editor. Write the code there.
> --
>
> John W. Vinson [MVP]
> .
>