Hi I am adding new record into subform via recordsetclone method. The problem is that record is added but on save it does not appear in the table. If add this record manual using subform everything works. When record added manually update of the record works fine.
here is my code.
here is my code.
Code:
'Add Wastage value to flooring area section
Private Sub Wastage_AfterUpdate()
Dim rsFlArea As DAO.Recordset
Dim Wastage As Double
Dim Item As String
Set rsFlArea = Me.OrderFloorAreaEdit.Form.RecordsetClone
'Caluate Wastage amount based on the percentage in parent form
Wastage = Format((Me.FloorMeterage.Value * Me.Wastage.Value), "#,##0.00")
'Check if it has been already added if not than add - note 12 is ID of floor area
rsFlArea.FindFirst "[Item] LIKE '12'"
If rsFlArea.NoMatch Then
rsFlArea.AddNew
rsFlArea!Item = 12
rsFlArea!Units = Wastage
rsFlArea!uPrice = Me.flPrice.Value
rsFlArea.Update
Else
' If value exist in recordset than update the value
Do Until rsFlArea.EOF
If rsFlArea!Item = 12 Then
rsFlArea.Edit
rsFlArea!Units = Format(((Me.FloorMeterage.Value - Nz(rsFlArea!Units, 0)) * Me.Wastage.Value), "#,##0.00")
rsFlArea.Update
End If
rsFlArea.MoveNext
Loop
End If
rsFlArea.Close
Set rsFlArea = Nothing
End Sub
Last edited: