From: stonward via AccessMonster.com on
Hi Guys,

This is driving me insane.....
Normally one would select products on an orders form from within a subform
that is linked to OrderDetails, this subform being linked via its PK to the
main form based upon Orders (say).

I have way too many products, of too complex a nature to select in this way.
So I have built a search form which shows the results of a search in a
listbox - which includes the products PK. Now, how do i add the selected item
in the listbox to an 'orderDetails' subform? It appears simple - a matter of
referencing a subform - but it's not!

Can anyone see this, or have I finally flipped?

Thanks for your time,

Stonward the Desperate

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1

From: Marshall Barton on
stonward via AccessMonster.com wrote:
>Normally one would select products on an orders form from within a subform
>that is linked to OrderDetails, this subform being linked via its PK to the
>main form based upon Orders (say).
>
>I have way too many products, of too complex a nature to select in this way.
>So I have built a search form which shows the results of a search in a
>listbox - which includes the products PK. Now, how do i add the selected item
>in the listbox to an 'orderDetails' subform? It appears simple - a matter of
>referencing a subform - but it's not!


Have you tried something like this in the list box's
AfterUpdate event?

With Forms!Orders.detailsubformcontrol.Form.Recordset
.AddNew
!productFK = Me.listbox
.Update
End With

Make sure that the listbox's bound column is the product PK
field.

--
Marsh
MVP [MS Access]
From: stonward via AccessMonster.com on
Marshall Barton wrote:
>>Normally one would select products on an orders form from within a subform
>>that is linked to OrderDetails, this subform being linked via its PK to the
>[quoted text clipped - 5 lines]
>>in the listbox to an 'orderDetails' subform? It appears simple - a matter of
>>referencing a subform - but it's not!
>
>Have you tried something like this in the list box's
>AfterUpdate event?
>
>With Forms!Orders.detailsubformcontrol.Form.Recordset
> .AddNew
> !productFK = Me.listbox
> .Update
>End With
>
>Make sure that the listbox's bound column is the product PK
>field.
>


No, not quite - I've been trying to open a form, whilst adding the record to
that forms subform - Gonna try your idea now. Thanks for your help - get back
to you asap.
Thanks again,

Stonward

--
Message posted via http://www.accessmonster.com