dbTalk Databases Forums  

Create Multiple Records

comp.databases.ms-access comp.databases.ms-access


Discuss Create Multiple Records in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bolen
 
Posts: n/a

Default Create Multiple Records - 09-27-2010 , 03:57 AM






I need some assistance and insight into creating multiple records in
Access from a single record in another table. For instance, I have a
form with two subforms with one used for accumulating the cost of
items purchased to assemble widgets. Once there are several widgets
finished, the other subform is used for indicating the number to be
transferred to a separate inventory table. So the point is that upon
clicking a button on the transfer subform, I need to create the
multiple records based on the number typed.

I have some experience in using the Open Recordset code and probably
could manage to do a one for one record creation, but one record to
many in another table is a little beyond my level. Any information and
assistance will be appreciated. Thanks.

Reply With Quote
  #2  
Old   
Marshall Barton
 
Posts: n/a

Default Re: Create Multiple Records - 09-27-2010 , 08:54 AM






Bolen wrote:

Quote:
I need some assistance and insight into creating multiple records in
Access from a single record in another table. For instance, I have a
form with two subforms with one used for accumulating the cost of
items purchased to assemble widgets. Once there are several widgets
finished, the other subform is used for indicating the number to be
transferred to a separate inventory table. So the point is that upon
clicking a button on the transfer subform, I need to create the
multiple records based on the number typed.

I have some experience in using the Open Recordset code and probably
could manage to do a one for one record creation, but one record to
many in another table is a little beyond my level.

Not sure I followed that, but you can make multiple records
from a single record by using a little utility table.

Create a table (named Numbers) with one integer field (named
Num). Populate this with values 1,2,3, ... up to more than
you will ever need.

Then you can use an append query kind of like this to create
however many records you need:

INSERT INTO inventory (s, a, b, ...)
SELECT Num, f1, f2, ...
FROM yourtable, Numbers
WHERE Num <= [Number of records to create]

--
Marsh

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.