Nino:
The approach you take depends on how you have the table that is to receive the new records set up.
For purposes of this example, I created a simple table with two fields: RecID (autonumber) and NewItem (Text).
I then created an unbound form with two controls:
lstItems
(list box where I typed in three values;
you can base yours on a table or query) with the
multi-select property set to Simple
cmdAddRecords
(command button).
In the On_Click event of the cmdAddRecords, I put this code:
Private Sub cmdAddRecords_Click()
Dim intCount As Integer 'count of items selected
Dim intLoop As Integer 'counter for loop
Dim dbTemp As Database
Dim rsTemp As Recordset
Set dbTemp = CurrentDb
Set rsTemp = dbTemp.OpenRecordset("tblListAdd"
intCount = lstItems.ItemsSelected.Count
'capture the number of selected items
For intLoop = 0 To intCount - 1
'uses 0 to start since ItemData is zero based
With rsTemp
.AddNew
.Fields(1) = lstItems.ItemData(intLoop)
.Update
End With
'Adds a new record and assigns the value to the
'second field (field counts are zero based)
'and updates the recordset
Next intLoop
'Processes the next choice if more than one selected.
rsTemp.Close
'closes the temporary recordset
End Sub
Give this a try.
You will need to modify where necessary for table and field names and, in the AddNew section, include all fields that need to be updated as well as their appropriate values.
I would suggest testing it on a test table/form before doing it for 'real'.
Good luck.
Larry De Laruelle
larry1de@yahoo.com