If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Automatically create a record in a subform
I have a pretty standard sales order database setup. (MS Access 2003)
I have a form that I enter the sales order number and customer info and a subform where I enter in the line items. We now need to add a generic "shipping" line item to every order everytime an new order is created in the main form. Can I have a generic "shipping" line item record automatially created in the subform for every order? I am completely comfortable with events and macros as long as it does not inclue VB. Thanks! |
#2
|
|||
|
|||
Automatically create a record in a subform
Hi 2Pence,
How about SQL? you could make an Append Query that pointed to the main form for the ID to fill in the related record and make a macro to run it -- that is not how I would do it, but then I like VBA smile Assuming the Primary Key field of the table that your form is based on is called OrderID and that is also the control name, and that is also the field name in the related table, you could make this query: INSERT INTO [Shipping Line Item Tablename] FIELDS ([OrderID_fieldname]) SELECT forms![Order Formname]![OrderID_controlname] you would make a macro to OpenQuery and assign it to run on the AfterInsert event of the Order form Warm Regards, Crystal remote programming and training Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day * 2Pence wrote: I have a pretty standard sales order database setup. (MS Access 2003) I have a form that I enter the sales order number and customer info and a subform where I enter in the line items. We now need to add a generic "shipping" line item to every order everytime an new order is created in the main form. Can I have a generic "shipping" line item record automatially created in the subform for every order? I am completely comfortable with events and macros as long as it does not inclue VB. Thanks! |
Thread Tools | |
Display Modes | |
|
|