Form Subform DLookup

  • Thread starter Thread starter John
  • Start date Start date
J

John

Team,

I have a Form / Subform (with tabs)

On the Subform, I want to:
1. Sum values located on the Form to values located on the Subform.
2. Be able to add a new record for a subsequent Change Order.

The latest attempt has been to display the sum is:
Private Sub txt_Change_Order_Current_Agreement_Value_AfterUpdate()
Me!txt_Change_Order_Current_Agreement_Value =
DLookup("ZPCM_Agreement_Value", "ZPCM", "ZPCM_ID=" & Me!txt_ZPCM_ID)
End Sub

It appears that the sum and the adding of a new record are mutually
exclusive. Is my assumption correct?
 
Neal,
thanks for your reply.

Let me clarify my thoughts...

My Form: ZPCM_form (has the value i want).
My subform: "Change_Order subform" (needs the calculation).

So, i need to:
1. pull the value in ZPCM_form (ZPCM_Agreement_Value) and
2. add it to Change_Order subform (Previous_Change_Order_Value) and
3. place the new resultant value in TextBox123.

Hope this is clearer.

--
Thanks for your time...

John


nrgins via AccessMonster.com said:
Your post is not clear. But, to get a value located on the subform from the
main form's code module, use this syntax:

Me.SubformcontrolName.Form!SubformValue

where SubformcontrolName is the name of the control on the main form that
holds the subform, and SubformValue is the field on the subform that you want
to look up.

If you want to sum values on a subform, simply put a (hidden or not hidden)
control in the subform's footer, and set its controlsource value to "=Sum(
[ControlName])" (without the quotes) where ControlName is the name of the
control you want to sum. You can then just refer to that summation control
from the main form using the above syntax.

HTH,

Neil

Team,

I have a Form / Subform (with tabs)

On the Subform, I want to:
1. Sum values located on the Form to values located on the Subform.
2. Be able to add a new record for a subsequent Change Order.

The latest attempt has been to display the sum is:
Private Sub txt_Change_Order_Current_Agreement_Value_AfterUpdate()
Me!txt_Change_Order_Current_Agreement_Value =
DLookup("ZPCM_Agreement_Value", "ZPCM", "ZPCM_ID=" & Me!txt_ZPCM_ID)
End Sub

It appears that the sum and the adding of a new record are mutually
exclusive. Is my assumption correct?
 
Back
Top