G
Guest
Friends,
I run into a strange behavior in Access 2003 when trying to add records into
a form based on a recordsetclone from another form. The scene is this. In a
page I have two subforms. The firsm subform contains information (primary
keys and foregin keys) that I want to copy into the other form before letting
the user att additional informatin in this form. The code is like this:
Dim rstPersonnel As Recordset
Set rstPersonnel = Me.fDPRPersonnelReport.Form.RecordsetClone
iDPRReportId = Me.dpr_report_id
With Me.fAssignedPersonnel.Form.RecordsetClone
If Not (.BOF And .EOF) Then
.MoveLast
iCounter = .RecordCount
.MoveFirst
While Not .EOF
rstPersonnel.AddNew
rstPersonnel.Fields("dpr_report_id") = iDPRReportId
rstPersonnel.Fields("resources_id") =
..Fields("resources_id")
rstPersonnel.Fields("number_of_persons") =
..Fields("number_of_units")
.MoveNext
Wend
End If
End With
Then the strange thing happens that the last record in the from - clone is
not inserted into the to - clone. Can anybody help me with a solution?
Leif S. (Norway)
I run into a strange behavior in Access 2003 when trying to add records into
a form based on a recordsetclone from another form. The scene is this. In a
page I have two subforms. The firsm subform contains information (primary
keys and foregin keys) that I want to copy into the other form before letting
the user att additional informatin in this form. The code is like this:
Dim rstPersonnel As Recordset
Set rstPersonnel = Me.fDPRPersonnelReport.Form.RecordsetClone
iDPRReportId = Me.dpr_report_id
With Me.fAssignedPersonnel.Form.RecordsetClone
If Not (.BOF And .EOF) Then
.MoveLast
iCounter = .RecordCount
.MoveFirst
While Not .EOF
rstPersonnel.AddNew
rstPersonnel.Fields("dpr_report_id") = iDPRReportId
rstPersonnel.Fields("resources_id") =
..Fields("resources_id")
rstPersonnel.Fields("number_of_persons") =
..Fields("number_of_units")
.MoveNext
Wend
End If
End With
Then the strange thing happens that the last record in the from - clone is
not inserted into the to - clone. Can anybody help me with a solution?
Leif S. (Norway)