Hi,
I have a form frmOrder and a subform sbfrmOrderDetails.
The PK OrderID for tblOrders is a autonumber. I want to create a sequential ID for tblOrderDetails such that OrderDetailID would be 8888.001, 888.002 etc. for OrderID 8888 and 8889.001, 8889.002 etc. for the next OrderID.
I've tried to put the following code on the BeforeInsert event field of sbfrmOrderDetails but it comes up with an error saying Run-time error '2465': Microsoft Access can't find the field 'frmOrders' referred to in your expression.
Me.SubOrderID = Nz(DMax("[SubOrderID]", "[tblOrderDetails]", "OrderID= " & Form!frmOrders!OrderID), 0) + 0.001
Help?
I have a form frmOrder and a subform sbfrmOrderDetails.
The PK OrderID for tblOrders is a autonumber. I want to create a sequential ID for tblOrderDetails such that OrderDetailID would be 8888.001, 888.002 etc. for OrderID 8888 and 8889.001, 8889.002 etc. for the next OrderID.
I've tried to put the following code on the BeforeInsert event field of sbfrmOrderDetails but it comes up with an error saying Run-time error '2465': Microsoft Access can't find the field 'frmOrders' referred to in your expression.
Me.SubOrderID = Nz(DMax("[SubOrderID]", "[tblOrderDetails]", "OrderID= " & Form!frmOrders!OrderID), 0) + 0.001
Help?