[AccessD] Second Try

Stuart McLachlan stuart at lexacorp.com.pg
Thu Mar 10 22:57:25 CST 2022


It sounds like you are using an unbound form for creating the new record. In that case, one 
way is to  pass the Order_ID o the opened form in OpenArgs and populate the FK field ion 
the form On_Load

On 10 Mar 2022 at 19:51, Arthur Fuller 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