Hi,
i am using code to populate subform:
and function :
For eACH record in subform with Server, Kind and Capacity
i am adding to other subform - UsageIDFK subform.
Code is working but after code - the changes are not saved.
Why?
Please help,
Best,
Jacek
i am using code to populate subform:
Code:
Private Sub CmdCopyPaste_Click()
Set frm = Me.frmDisksSubform.Form
Dim rst As dao.Recordset
Dim frmSubName As String
Dim subFrm As Access.Form
Dim col As New Collection
For Each varitem In Me.LstFormList.ItemsSelected
frmSubName = Me.LstFormList.Column(0, varitem)
Next varitem
For Each varitem In Me.LstFieldsToAdd.ItemsSelected
col.Add Me.LstFieldsToAdd.Column(0, varitem)
Next varitem
Set rst = fLoadRstWithSelected(frm)
With rst
.MoveFirst
Do While Not .EOF
With Me.Controls(frmSubName).Form.RecordsetClone
[B] For Each colItem In col
.AddNew
!UsageIDFK = colItem
.Update
Next[/B]
End With
' Debug.Print rst.Fields(0)
.MoveNext
Loop
End With
End Sub
and function :
Code:
Function fLoadRstWithSelected(pForm) As dao.Recordset
Dim rst As dao.Recordset
Set rst = pForm.Form.Recordset
Set fLoadRstWithSelected = rst
End Function
For eACH record in subform with Server, Kind and Capacity
i am adding to other subform - UsageIDFK subform.
Code is working but after code - the changes are not saved.
Why?
Please help,
Best,
Jacek