A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Automatically create a record in a subform



 
 
Thread Tools Display Modes
  #1  
Old January 22nd, 2009, 07:03 PM posted to microsoft.public.access.forms
2Pence
external usenet poster
 
Posts: 1
Default 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  
Old January 23rd, 2009, 12:42 PM posted to microsoft.public.access.forms
strive4peace
external usenet poster
 
Posts: 1,670
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.