From: TL on
What is the code and where should it be place to update a main form combo box
after entering data into a subform combox?
From: Duane Hookom on
Try the after update event of the subform combo box.

--
Duane Hookom
MS Access MVP


"TL" <TL(a)discussions.microsoft.com> wrote in message
news:A3A1F486-3C83-4F64-A641-F5AA9E9DDFC7(a)microsoft.com...
> What is the code and where should it be place to update a main form combo
> box
> after entering data into a subform combox?

From: Armen Stein on
On Mon, 22 Mar 2010 19:26:18 -0500, "Duane Hookom"
<duanehookom(a)gmail.com> wrote:

>Try the after update event of the subform combo box.

And you can refer to the combobox on the main form from the subform
using syntax like:

Me.Parent!MyComboBoxName

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

From: TL on
I have tried the code you detailed but keep coming up with a "Compile
Error:Syntax Error"

Not sure whether the "Parent" section of the "Me.Parent!LOTOGroups" code
referenced the mainform I tried leaving it as parent and also entering the
mainforms name and keep receiving above error.

The subform combo box "LOTOGroups" enters data into a LOTOtable.
The LOTOtable has a one-to-many relationship with a PREVENTTable.
The mainforms combo box "LOTOGroup" has a row source of "SELECT [LOTO
Table].[LOTOGroups] FROM [LOTO Table] ORDER BY [LOTOGroups];"

I'm note sure where I'm going wrong - could it be the query behind the
mainform?


"Armen Stein" wrote:

> On Mon, 22 Mar 2010 19:26:18 -0500, "Duane Hookom"
> <duanehookom(a)gmail.com> wrote:
>
> >Try the after update event of the subform combo box.
>
> And you can refer to the combobox on the main form from the subform
> using syntax like:
>
> Me.Parent!MyComboBoxName
>
> Armen Stein
> Microsoft Access MVP
> www.JStreetTech.com
>
> .
>
From: Armen Stein on
On Tue, 23 Mar 2010 07:08:08 -0700, TL <TL(a)discussions.microsoft.com>
wrote:

>I have tried the code you detailed but keep coming up with a "Compile
>Error:Syntax Error"
>
>Not sure whether the "Parent" section of the "Me.Parent!LOTOGroups" code
>referenced the mainform I tried leaving it as parent and also entering the
>mainforms name and keep receiving above error.
>
>The subform combo box "LOTOGroups" enters data into a LOTOtable.
>The LOTOtable has a one-to-many relationship with a PREVENTTable.
>The mainforms combo box "LOTOGroup" has a row source of "SELECT [LOTO
>Table].[LOTOGroups] FROM [LOTO Table] ORDER BY [LOTOGroups];"
>
>I'm note sure where I'm going wrong - could it be the query behind the
>mainform?

The rowsource of the combobox shouldn't be an issue, nor should the
query behind they main form. You're having trouble just referencing
the combobox, which result in a compile error. The fact that it is a
syntax error means that you likely haven't written the line of code
correctly. Post your exact code for us to look at.

Also, use the immediate window (Ctrl-G) while your form is open to try
a direct reference.

?Forms!MyMainFormName!LOTOGroups

Does that return a value? If not, maybe the form isn't truly the top
level form, maybe it is another subform?

Armen Stein
Microsoft Access MVP
www.JStreetTech.com