A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form Subform DLookup



 
 
Thread Tools Display Modes
  #1  
Old June 7th, 2010, 05:15 PM posted to microsoft.public.access.forms
John
external usenet poster
 
Posts: 2,649
Default Form Subform DLookup

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_AfterUpda te()
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?

---
Thanks for your time...

John
Ads
  #2  
Old June 7th, 2010, 06:59 PM posted to microsoft.public.access.forms
nrgins via AccessMonster.com
external usenet poster
 
Posts: 3
Default Form Subform DLookup

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


John wrote:
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_AfterUpda te()
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?

---
Thanks for your time...

John


--
Message posted via http://www.accessmonster.com

  #3  
Old June 7th, 2010, 09:13 PM posted to microsoft.public.access.forms
John
external usenet poster
 
Posts: 2,649
Default Form Subform DLookup

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" wrote:

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


John wrote:
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_AfterUpda te()
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?

---
Thanks for your time...

John


--
Message posted via http://www.accessmonster.com

.

  #4  
Old June 7th, 2010, 09:25 PM posted to microsoft.public.access.forms
nrgins via AccessMonster.com
external usenet poster
 
Posts: 3
Default Form Subform DLookup

Clearer, but still not totally clear.

What triggers this calculation?

Where is TextBox123 -- on the main form or subform?

OK, let's assume that everything happens on the subform (since that's the
easier scenario :-) ). That is, user does something on the subform (enters a
value, clicks a button, whatever) that triggers this calculation, and the
result is then written to TextBox123 on the subform.

In that case, it's simple: in the subform's code module, get the value from
the parent form (ZPCM_form) using the Me.Parent syntax, as follows

Me.Parent!ZPCM_Agreement_Value

If you're not doing everything in the subform, then you'll need to be clearer
in your explanation (and please be clearer in the future so as to avoid all
this back and forth - thanks!).

Neil


John wrote:
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.

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

[quoted text clipped - 36 lines]

John


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201006/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 OfficeFrustration.
The comments are property of their posters.