Solved

Help with Calculation on the third form

Posted on 2015-02-03
14
80 Views
Last Modified: 2015-02-06
On form B, I have a field that is a calculation based in a query....I have no problems.  My third form is where I am having problems.  Can I refer formB.FieldTotal2 and use it in formC.FieldBegTotal3

So here is what I am trying to do

Final_frm2                             Final_frm3                         Final_frm4
BegTotal-->TotalBC2         TotalBC2-->TotalBC3         TotalBC3-->TotalBC4

These fields began with a calculations.....
0
Comment
Question by:Jass Saini
  • 8
  • 3
  • 2
  • +1
14 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40587263
you can get the value of a control from a form with this

Forms!NameOfForm.Controlname

so in form "Final_frm3", you can do this

me.TotalBC3= Forms!Final_frm2.TotalBC2

now you just have to figure out the events that you need

try using the Form's Load Event and/or Form's Current event
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40587395
JAss SAini,
<Just FYI, No points wanted>

What Rey posted is the exact same syntax as was used in your previous question(s)

So see this link for info on referencing form controls...
http://access.mvps.org/access/forms/frm0031.htm

JeffCoachman
0
 

Author Comment

by:Jass Saini
ID: 40587525
So my field is not bound to my table...Also that does not work for me and I am not sure why
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40587539
<Also that does not work for me and I am not sure why >

so are we.. you, can see what you did and you  are sure why it is not working, how do you expect us to give comments without seeing what you did..
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40588336
Are these Subforms? If so, you'll have to refer to them differently. But as Rey and Jeff have said, we can't really help you if you don't give us the information we need ...
0
 

Author Comment

by:Jass Saini
ID: 40588898
Yes..these are subforms...

The first subform refers back to a field on the table...No problem.  I have no issues with that.

Second subform...I used a calculation in query..here is that

Beg Total for form 2

BegTotal: Nz([Final_Table].[Total Initial],0)+Nz([BC1Chng1],0)+Nz([BC1Chng2],0)+Nz([BC1Chng3],0)+Nz([BC1Chng4],0)+Nz([BC1Chng5],0)+Nz([BC1Chng6],0)+Nz([BC1Chng7],0)+Nz([BC1Chng8],0)+Nz([BC1Chng9],0)+Nz([BC1Chng10],0)

End total for Form 2

TotalBC2: Nz([BegTotal],0)+Nz([BC2Chng1],0)+Nz([BC2Chng2],0)+Nz([BC2Chng3],0)+Nz([BC2Chng4],0)+Nz([BC2Chng5],0)+Nz([BC2Chng6],0)+Nz([BC2Chng7],0)+Nz([BC2Chng8],0)+Nz([BC2Chng9],0)+Nz([BC2Chng10],0)

This is not causing me an issue either

The third form Beginning Total should be form 2 end total:

BegTotal3: Nz([Final_Table Query2].[BegTotal],0)+Nz([BC2Chng1],0)+Nz([BC2Chng2],0)+Nz([BC2Chng3],0)+Nz([BC2Chng4],0)+Nz([BC2Chng5],0)+Nz([BC2Chng6],0)+Nz([BC2Chng7],0)+Nz([BC2Chng8],0)+Nz([BC2Chng9],0)+Nz([BC2Chng10],0)

When I run the query..it is asking me to supply the Parameter Value for Final_Table Query2.BegTotal.
The box says to "Enter Parameter Value" and it says the field name.

My query are named Final_Table Query2 and Final_Table Query3 respectively.  The subform are called fsub_Final_Table Query2 and Query3 respectively.

Hope this helps..I have tried every different combination (subform name and query name) and each time it ask me to enter the parameter value
0
 

Author Comment

by:Jass Saini
ID: 40588968
I just tried putting =[Forms]![fsub_Final_Table Query2]![TotalBC2] in the BegTotal3 control source.  It does return a value..but the value is returns is the first value in that field for all the records..meaning it is returning the same value in the entire form
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 84
ID: 40589124
Is the "Final_Table Query2" table part of your query?

If BegTotal a calculated field?
0
 

Author Comment

by:Jass Saini
ID: 40589167
Sorry ....Final_table Query2 is a query....

I am trying to do all the calculation within the query..as I was told it's not good practice to have a calculated field in the table.
0
 

Author Comment

by:Jass Saini
ID: 40589827
Yes ..BegTotal is calculated field.

BegTotal: Nz([Final_Table].[Total Initial],0)+Nz([BC1Chng1],0)+Nz([BC1Chng2],0)+Nz([BC1Chng3],0)+Nz([BC1Chng4],0)+Nz([BC1Chng5],0)+Nz([BC1Chng6],0)+Nz([BC1Chng7],0)+Nz([BC1Chng8],0)+Nz([BC1Chng9],0)+Nz([BC1Chng10],0)
0
 
LVL 84
ID: 40590848
When I run the query..it is asking me to supply the Parameter Value for Final_Table Query2.BegTotal.
The box says to "Enter Parameter Value" and it says the field name.
This normally means you've misspelled a Table or Field name, or you're trying to refer to a Table or Field that is NOT part of the Query.

If you run the query in the query designer, do you still get the prompt?
0
 

Author Comment

by:Jass Saini
ID: 40591436
Do you mean in design view?? Yes I still get the same prompt.  The field is in a subform...
0
 

Author Comment

by:Jass Saini
ID: 40594338
That's okay..I did the calculation based off the one field in the table..Thanks for your help
0
 

Author Closing Comment

by:Jass Saini
ID: 40594905
Thanks..I used the long way to get my calculations
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now