Automatically create a record in a subform

2

2Pence

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!
 
S

strive4peace

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 :)
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top