Hi there
I need to update a field on my main form using the value of a field on my sub-form. I have created a text box on the subform called txtcountitems which counts the item_id field of that form. This seems to work ok. However I have tried putting the following code on the after update (also tried after insert) event of the subform but it seems to partly work in that it is always 1 record behind the correct one. ie I add the first record to the subform and the field on the main form remains as 0 - I add the 2nd record and it goes to 1. Can anyone advise what I am doing wrong?
If CurrentProject.AllForms("frmIncidentNew").IsLoaded = True Then
Forms!frmIncidentNew!txtItemCount.Value = Me.Txtcountitems.Value
ElseIf CurrentProject.AllForms("frmIncidentDetails").IsLoaded = True Then
Forms!frmIncidentdetails!txtItemCount.Value = Me.Txtcountitems.Value
End If
I need to update a field on my main form using the value of a field on my sub-form. I have created a text box on the subform called txtcountitems which counts the item_id field of that form. This seems to work ok. However I have tried putting the following code on the after update (also tried after insert) event of the subform but it seems to partly work in that it is always 1 record behind the correct one. ie I add the first record to the subform and the field on the main form remains as 0 - I add the 2nd record and it goes to 1. Can anyone advise what I am doing wrong?
If CurrentProject.AllForms("frmIncidentNew").IsLoaded = True Then
Forms!frmIncidentNew!txtItemCount.Value = Me.Txtcountitems.Value
ElseIf CurrentProject.AllForms("frmIncidentDetails").IsLoaded = True Then
Forms!frmIncidentdetails!txtItemCount.Value = Me.Txtcountitems.Value
End If