Ok I am working on my Customer Order Forms.
Tables Involved are Customers, Orders, and OrderDetails.
Forms are called: frmCustomers, frmOrders, and sbfrmOrderdetails.
I have it set up like this.
1: Customer Profile Form with a button that says Add New Order.
2: Click the Add New Order Button.
3: The Order Form Pops Up with the OrderDetails Subform attached to the Orders Form.
Very basic simple but I can't figure out how to get the CustomerID to match up on the Orders Form when I click the Add New Orders button.
On the Add New Orders button I have set up and tried some code and Macros like:
OnClick: OpenForm frmOrders Where Condition setting being "[CustomerID]=" & Me![CustomerID]
I have tried different things nothing. Also I would like a button or radio button in my Orders Form to autofill the shipping address information tot he same as billing information.
Remember this is to link the Orders Form with the customer on existing customers AND NEW customers also.
CustomerID Links Customers to Orders and Order ID Links Orders to Order Details.
anyway, I think a better place would be on the AfterInsert event just in case the user changes their mind about creating a record
Alternatively, I think you can also put what Scott mentioned in the DefaultValue property for the CustomerID control (Visible=No), prefaced with =
be sure before you open a form, you save the record you are on if it is dirty (has unsaved changes)
Open in new windowit is best to test IF a record needs to be saved and only save it if needed.