Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A FORM that automatically inserts RECORDS

Status
Not open for further replies.

Taran72

Technical User
Nov 1, 2001
8
US
Hello all, it's been a while - I ALMOST forgot how great this site is!

I am creating a basic data entry form. What's not so basic is this: I would like a field that will automatically insert a certain number of records. For example, I am tracking defective products. Sometimes I may get a batch of defective products, like 5-50, and I need them tracked individually but I do not want to enter them all manually.

For example, I would like to be able to enter

DATE, SHIFT, DEFECT DESCRIPTION, NUMBEROFPRODUCTS

and the NUMBEROFPRODUCTS field would automatically insert a number of records in the DB with the same characteristics (DATE, SHIFT, DEFECT DESCRIPTION)of that record. I have an autonumber primary key, of course, and I do not need to store the NUMBEROFPRODUCTS value.

Thanks for your help!

Dan
 
You may consider a DoCmd.RunSQL "INSERT INTO ..." inside a For ... Next loop.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi
Something like (?):
Code:
Dim rs As Recordset
Set rs=Me.RecordsetClone
For i = 1 to Me!NumberOfProducts
  With rs
    .AddNew
    !Date=Me!Date
    !Shift=Me!Shift
    !DefectDesc=Me!DefectDesc
    !Update
  End With
Next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top