Reputation: 1109
Is it possible to add multiple data that has been selected from a subform to the main form?
Upvotes: 0
Views: 296
Reputation: 16
To select data it is better to use a listfield and then copy the data with a VB program in the table:
set rs1=currendb.openrecordset ("NAME OF TABLE)
For Z = 0 To Me.ListField.ListCount - 1
If Me.ListField.Selected(Z) = True Then
Rs1.addnew
rs1!field1 = Me.LisField.Column(0, Z)
rs1!field2 = Me.LisField.Column(1, Z)
End If
next z
Upvotes: 0
Reputation: 27634
Form.SelTop and .SelHeight are the key properties here.
Example with a subform.RecordsetClone loop:
Set F = Me.Subform.Form
Set RS = F.RecordsetClone
RS.MoveFirst
' goto first selected record
RS.Move F.SelTop - 1
' loop over all selected records
For i = 1 To F.SelHeight
' do something with fields from RS
RS.MoveNext
Next i
Upvotes: 1