I'm fairly new at using VBA with recordsets. I'm trying to copy the data from one subform to another. The code I've written so far only moves the first record or selected record to the destination subform.
Any help will be greatly appreciated. Thanks, Kopy.
Here's my code:
===========================================================
Private Sub Command55_Click()
Dim rst As DAO.Recordset, sfrm As Form, sfrm1 As Form
Set sfrm = Forms![frmQuotes]![subUnionOperations].Form
Set rst = sfrm.RecordsetClone
Set sfrm1 = Forms![frmQuotes]![tblQuoteOps subform].Form
Set rst1 = sfrm1.RecordsetClone
If rst.RecordCount >= 1 Then
rst.MoveFirst
End If
Do
rst1.AddNew
Me![tblQuoteOps subform].Form![txtOperationNumber] = Me![subUnionOperations].Form![txtOperationNumber]
Me![tblQuoteOps subform].Form![txtType] = Me![subUnionOperations].Form![txtType]
Me![tblQuoteOps subform].Form![cboDesc] = Me![subUnionOperations].Form![cboDesc]
Me![tblQuoteOps subform].Form![txtSetUpTime] = Me![subUnionOperations].Form![txtSetUpTime]
Me![tblQuoteOps subform].Form![txtRunTime] = Me![subUnionOperations].Form![txtRunTime]
rst.MoveNext
Loop Until rst.EOF
End Sub
Any help will be greatly appreciated. Thanks, Kopy.
Here's my code:
===========================================================
Private Sub Command55_Click()
Dim rst As DAO.Recordset, sfrm As Form, sfrm1 As Form
Set sfrm = Forms![frmQuotes]![subUnionOperations].Form
Set rst = sfrm.RecordsetClone
Set sfrm1 = Forms![frmQuotes]![tblQuoteOps subform].Form
Set rst1 = sfrm1.RecordsetClone
If rst.RecordCount >= 1 Then
rst.MoveFirst
End If
Do
rst1.AddNew
Me![tblQuoteOps subform].Form![txtOperationNumber] = Me![subUnionOperations].Form![txtOperationNumber]
Me![tblQuoteOps subform].Form![txtType] = Me![subUnionOperations].Form![txtType]
Me![tblQuoteOps subform].Form![cboDesc] = Me![subUnionOperations].Form![cboDesc]
Me![tblQuoteOps subform].Form![txtSetUpTime] = Me![subUnionOperations].Form![txtSetUpTime]
Me![tblQuoteOps subform].Form![txtRunTime] = Me![subUnionOperations].Form![txtRunTime]
rst.MoveNext
Loop Until rst.EOF
End Sub