[AccessD] Second Try

Charlotte Foust charlotte.foust at gmail.com
Thu Mar 10 21:55:09 CST 2022


The way I always handled this was to have a zero-width unbound control on
the subform which inherits the parent record key.  Then, I put code behind
the ID control on the subform to check and see if the record was a new one,
so it would know whether to copy the key from the unbound control.

Charlotte Foust
(916) 206-4336


On Thu, Mar 10, 2022 at 4:51 PM Arthur Fuller <fuller.artful at gmail.com>
wrote:

> Earlier today I posted a message, or thought I did, but haven't seen it
> appear yet, so I'm resending it.
>
> I have a form in datasheet format. It's actually a subform. The bottom row
> contains the word New. When I click this, I open a single-row form that
> allows editing or addition, depending on the argument I pass. The problem
> is that when adding a new row, the form does not inherit the parent key.
> For example, if I'm trying to add an Order Detail, it does not inherit the
> Order_ID. I have tried a few approaches but am not getting what I want.
>
> This does not work.
> <code<
>     DoCmd.OpenForm "Order_Detail_frm", View:=acNormal, DataMode:=acFormAdd
>     Me.Order_ID = Me.Parent.OrderID
> '    DoCmd.OpenForm "Order_Detail_frm", acNormal, , "ID=" & Me.ID,
> acFormEdit, acDialog
> </code>
> Any suggestions?
>
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list