I am using an unbound form to move products and keep track of inventory.
To manage the database easier each item that we physically have gets its own record. 1 record = 1 item etc..
so on the form I have Product and Quantity.. I have my code that will create one record per product put in the form. I can't figure out how to create say 20 records for item1 and 10 records for item2
Code:
Private Sub Command61_Click()
Dim DBSS As Database
Dim rs As DAO.Recordset
Dim i As Integer
Set DBSS = CurrentDb
Set rs = CurrentDb.OpenRecordset("SELECT ProductName, OldLocation, NewLocation FROM tblTransfers")
For i = 1 To 20
If Me.Controls("item" & i) & "" = "" Then
Exit For
Else
With rs
.AddNew
!ProductName = Me.Controls("item" & i).Value
!OldLocation = Me.txtFrom.Value
!NewLocation = Me.txtTo.Value
.Update
End With
End If
Next i
rs.Close
Set rs = Nothing
DoCmd.Close
End Sub
The Quantity TextField in the form is Quan1 to Quan20
Hopefully i explained well enough..
Thanks
Zook