Form to auto-populate rows in a table

Roo Murray

New member
Local time
Today, 01:15
Joined
Aug 26, 2010
Messages
8
Hi guys,

I'm trying to figure out a way of auto populating a table from a few text boxes on a form.

The entry form will show:
Lot number "12345"
Overall qty: "150"
Number of Lots "10"

What I would like to do is on the press of a button 10 rows to be created with:

Lotnumber Qty
12345-1 15
12345-2 15 etc etc

The lot number is created from the Text Lot number + "-" + the 1 -10.
The Qty is cteated from the Overall qty divided by the number of lots.

I've been trying to put something together - and as a beginner this is as far as I have got:

Private Sub Command4_Click()
Dim i As Long, myRS As Recordset
Set myRS = CurrentDb.OpenRecordset("Table1")
For i = 1 To Me![txt_overallqty]
With myRS
.AddNew
![lotnumber] = Me![txt_Lotnumber]
.Update
End With
Next
End Sub
 

Users who are viewing this thread

Back
Top Bottom