I have a very strange problem.
Background: I have a main form on based on a table. I have an unbound combo search field on this form. After update I select the correct record from the table to display (recordset bookmark).
I have sub form on the main form containing transactions pertaining to the record on the main form. (Linked by ID to tbl_Mainform_ID) All this works perfectly.
In the footer of the subform I have a field called fld_endamount1 : = nz(sum(fld_endamount);0)
Problem1: I have a field on the main form displaying the endamount from the sub form : =forms!mainform!subform.form!endamount1
This works after selecting a record but as the form opens on a new record (and can be used to enter a new customer) this field display #error until there are records in the sub form.
Problem 2: I have tried to solve this in vba by placing a procedure on "after update" of the unbound search field.
(Restzahlung being an unbound form on the main form where I basically want to show the end amount of the customer as in the footer of the sub form.)
Dim x As Long
x = Me.frmUF_BrideDress.Form.RecordsetClone.RecordCount
If x > 0 Then
me.Restzahlung = [Forms]![frm_bride]![frmUF_BrideDress].[Form]![sumendpreis]
ElseIf x = 0 Then
Me.Restzahlung = 0
End If
Exit Sub
This works fine as long as I put a stop in the procedure and do it step by step. As soon as I remove the stop it just sets me.Restzahlung at 0.
I have NO IDEA why this would work with a stop in and not without.
Can anyone help me please?
Thanks
Marion
Background: I have a main form on based on a table. I have an unbound combo search field on this form. After update I select the correct record from the table to display (recordset bookmark).
I have sub form on the main form containing transactions pertaining to the record on the main form. (Linked by ID to tbl_Mainform_ID) All this works perfectly.
In the footer of the subform I have a field called fld_endamount1 : = nz(sum(fld_endamount);0)
Problem1: I have a field on the main form displaying the endamount from the sub form : =forms!mainform!subform.form!endamount1
This works after selecting a record but as the form opens on a new record (and can be used to enter a new customer) this field display #error until there are records in the sub form.
Problem 2: I have tried to solve this in vba by placing a procedure on "after update" of the unbound search field.
(Restzahlung being an unbound form on the main form where I basically want to show the end amount of the customer as in the footer of the sub form.)
Dim x As Long
x = Me.frmUF_BrideDress.Form.RecordsetClone.RecordCount
If x > 0 Then
me.Restzahlung = [Forms]![frm_bride]![frmUF_BrideDress].[Form]![sumendpreis]
ElseIf x = 0 Then
Me.Restzahlung = 0
End If
Exit Sub
This works fine as long as I put a stop in the procedure and do it step by step. As soon as I remove the stop it just sets me.Restzahlung at 0.
I have NO IDEA why this would work with a stop in and not without.
Can anyone help me please?
Thanks
Marion