473,378 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Calculated form field control not working: Access 2000 Prm

Dököll
2,364 Expert 2GB
Hello Hello!

Hope it's a good week-end near you...

I am trying to substract then divide through a form field to no avail.

What do you make of it?

(1) Achieved form grabs a certain number of instances for specific fields, Compensation Question field, as one example, having many instances where a Compensation Question was raised

(2) QuestionQuestions subform collects data specific to days where Compensation Question not answered, being used to substract from Achieved

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Forms]![Achieved]![Compensation Question]-[Forms]![QuestionQuestions subform]![Compensation Question]/[Forms]![Achieved]![Compensation Question]
  3.  
  4.  
I think the problem is I cannot get my form data to communicate with its subform. I beat it up quite a bit an the machine goes mute on me.

Would you tell me what you see? Thanks, and enjoy your week-end:-)

Dököll
Sep 15 '07 #1
11 1882
JConsulting
603 Expert 512MB
Hello Hello!

Hope it's a good week-end near you...

I am trying to substract then divide through a form field to no avail.

What do you make of it?

(1) Achieved form grabs a certain number of instances for specific fields, Compensation Question field, as one example, having many instances where a Compensation Question was raised

(2) QuestionQuestions subform collects data specific to days where Compensation Question not answered, being used to substract from Achieved

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Forms]![Achieved]![Compensation Question]-[Forms]![QuestionQuestions subform]![Compensation Question]/[Forms]![Achieved]![Compensation Question]
  3.  
  4.  
I think the problem is I cannot get my form data to communicate with its subform. I beat it up quite a bit an the machine goes mute on me.

Would you tell me what you see? Thanks, and enjoy your week-end:-)

Dököll

if you think your logic and values will work...you might try this syntax

[Forms]![Achieved]![Compensation Question]-
[Forms]![QuestionQuestions subform].Form.[Compensation Question]
/[Forms]![Achieved]![Compensation Question]
Sep 15 '07 #2
Dököll
2,364 Expert 2GB
if you think your logic and values will work...you might try this syntax

[Forms]![Achieved]![Compensation Question]-
[Forms]![QuestionQuestions subform].Form.[Compensation Question]
/[Forms]![Achieved]![Compensation Question]
Much appreciated...

Looks like we need to have another look, it does not seem to work at my end of it. It may be just a simple thing, that's what's a bit of an annoyance. Does it accurately substract then divide near you?

You know what! Perhaps I should try:

Expand|Select|Wrap|Line Numbers
  1.  
  2. [Query]![Achieved]![Compensation Question]-
  3. [Query]![QuestionQuestions]![Compensation Question]
  4. /[Query]![Achieved]![Compensation Question][/quote]Much appreciated...
  5.  
  6.  
I am not sure if this will work, just thinking outloud:-)

Thanks, JConsulting, in a bit, I think I'll try it, see what happens!
Sep 16 '07 #3
Dököll
2,364 Expert 2GB
Much appreciated...

Looks like we need to have another look, it does not seem to work at my end of it. It may be just a simple thing, that's what's a bit of an annoyance. Does it accurately substract then divide near you?

You know what! Perhaps I should try:

Expand|Select|Wrap|Line Numbers
  1.  
  2. [Query]![Achieved]![Compensation Question]-
  3. [Query]![QuestionQuestions]![Compensation Question]
  4. /[Query]![Achieved]![Compensation Question]
Expand|Select|Wrap|Line Numbers
  1. Much appreciated...
  2.  
  3.  
I am not sure if this will work, just thinking outloud:-)

Thanks, JConsulting, in a bit, I think I'll try it, see what happens![/quote]

It did not work either through query, weird:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Achieved]![Compensation Question]-[QuestionQuestions]![Compensation Question]/[Achieved]![Compensation Question]
  3.  
  4.  
Sep 16 '07 #4
JConsulting
603 Expert 512MB
Much appreciated...

[/code]

I am not sure if this will work, just thinking outloud:-)

Thanks, JConsulting, in a bit, I think I'll try it, see what happens!
It did not work either through query, weird:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Achieved]![Compensation Question]-[QuestionQuestions]![Compensation Question]/[Achieved]![Compensation Question]
  3.  
  4.  
[/quote]


The sample I gave you earlier included the "Form" operator in the string that references the subform value. If that did not work then the way you're trying to use it won't.

Here's what you do. Create a textbox on the main form. Call it SubCompQ or something like that.

Now, on the subform, on the On_Current event, set the value of that new textbox on the main form like this

me.Parent.SubCompQ = me.[Compensation Question]

now instead of trying to use the subform value...use your new field

=[Achieved]![Compensation uestion]-
me.[SubCompQ]/
[Achieved]![Compensation Question]

Hope this makes sense..
J
Sep 18 '07 #5
Dököll
2,364 Expert 2GB
It makes plenty of sense J, genius, and I am going to try your example but please read on, pretty similar to yours...

I did figure out that I am just a bonehead. Your examples previously should have worked; not in query but at least with form data. I do not know what went on with the query but:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Achieved].Form!Compensation Question
  3.  
  4.  
that should have worked...

What I did not tell you, because I did not know this up till Friday, sixish, is that Compesation Question is the Control Source, I needed to reference the field name (the textbox name), thus:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Achieved].Form!CompensationQ
  3.  
  4.  
Just like you said:-)

I can't keep it straight though. I do not understand when it is necessary to use the field name. And it looks like this only work with the subform data, the form itself is fine. For instance:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Achieved].Form!Compensation Question
  3.  
  4.  
this works on the form (Achieved). Not on for subform, even though the form and subform Control Source has the same name (Please throw your hat in here, perhaps subform fields should be specific and different from form itself)...

...going forward, I will try your example because it seems cleaner. This is the result thus far:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =([Achieved].Form![Compensation Question] - [QuestionQuestion].Form![CompensationQ])/([Achieved].Form![Compensation Question]) 
  3.  
  4.  
I was also getting weird results, I figured out I did not enclose in parenthesis so calculations are handled seperately, again, I am a bonehead:-)
Sep 23 '07 #6
ADezii
8,834 Expert 8TB
Hello Hello!

Hope it's a good week-end near you...

I am trying to substract then divide through a form field to no avail.

What do you make of it?

(1) Achieved form grabs a certain number of instances for specific fields, Compensation Question field, as one example, having many instances where a Compensation Question was raised

(2) QuestionQuestions subform collects data specific to days where Compensation Question not answered, being used to substract from Achieved

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Forms]![Achieved]![Compensation Question]-[Forms]![QuestionQuestions subform]![Compensation Question]/[Forms]![Achieved]![Compensation Question]
  3.  
  4.  
I think the problem is I cannot get my form data to communicate with its subform. I beat it up quite a bit an the machine goes mute on me.

Would you tell me what you see? Thanks, and enjoy your week-end:-)

Dököll
Your problem is both Syntax and Order of Precedence related. The Division operation will be executed prior to the Subtraction operation, because it has a higher priority (Order of Precedence).
Expand|Select|Wrap|Line Numbers
  1. Debug.Print 18 - 10  / 4 will evaluate to 15.5 not 2 
  2. Debug.Print ((18 - 10) / 4) will evaluate to 2     'the correct result
  3.  
The Default behavior can be overwritten with nested parenthesis. The operation within the inner parenthesis, Subtraction, will be performed prior to the Division. Note the syntax change in referring to the Sub-Form Control, also:
Expand|Select|Wrap|Line Numbers
  1. =(([Forms]![Achieved]![Compensation Question]-[Forms]![QuestionQuestions subform].Form![Compensation Question])/[Forms]![Achieved]![Compensation Question])
Sep 23 '07 #7
Dököll
2,364 Expert 2GB
It did not work either through query, weird:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =[Achieved]![Compensation Question]-[QuestionQuestions]![Compensation Question]/[Achieved]![Compensation Question]
  3.  
  4.  

The sample I gave you earlier included the "Form" operator in the string that references the subform value. If that did not work then the way you're trying to use it won't.

Here's what you do. Create a textbox on the main form. Call it SubCompQ or something like that.

Now, on the subform, on the On_Current event, set the value of that new textbox on the main form like this

me.Parent.SubCompQ = me.[Compensation Question]

now instead of trying to use the subform value...use your new field

=[Achieved]![Compensation uestion]-
me.[SubCompQ]/
[Achieved]![Compensation Question]

Hope this makes sense..
J[/quote]Yes it does make sense, J, looks like I need to take a closer look:

Expand|Select|Wrap|Line Numbers
  1.  
  2. me.Parent.SubCompQ = me.[Compensation Question]
  3.  
  4.  
Do you mean to say there is an event/procedure area called On_Current?

I like your idea, I would like to try it if you could go a little more into it.

Am I right clicking the form or the field?

I am sure this silly a question, it's probably right there and I can't see it. Thanks!
Sep 25 '07 #8
Dököll
2,364 Expert 2GB
The Default behavior can be overwritten with nested parenthesis. The operation within the inner parenthesis, Subtraction, will be performed prior to the Division. Note the syntax change in referring to the Sub-Form Control, also:
Expand|Select|Wrap|Line Numbers
  1. =(([Forms]![Achieved]![Compensation Question]-[Forms]![QuestionQuestions subform].Form![Compensation Question])/[Forms]![Achieved]![Compensation Question])
You are correct, ADezii...I am sure you saw my reply to JConsulting previously, but I wanted to thank you. Looks like I am on the right path with it. Thanks!
Sep 25 '07 #9
ADezii
8,834 Expert 8TB
You are correct, ADezii...I am sure you saw my reply to JConsulting previously, but I wanted to thank you. Looks like I am on the right path with it. Thanks!
You are quite welcome.
Sep 25 '07 #10
Dököll
2,364 Expert 2GB
I am just throwing this out there while I fetch here, may have been added. I want to, within the same form, add another subform to collect other data, then look up Compensation Question field to see if values are zero, if so, load zero, but if values are higher than zero, to look up teh other subform to see if value there is set to TRUE (a checkbox field), then reflect zero for Compensation Question field:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question]))
  3.  
  4.  
Not sure how to continue this to grab the additional field, set to TRUE, to compute a zero when TRUE is found there (again, TRUE is a selected checkbox)

In therory, below looks pretty:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question])) 
  3.  
  4. OR
  5.  
  6. IIf(IsNull(CheckMeQuestions subform.Form![Compensation Question]),0,(CheckMeQuestions subform.Form![Compensation Question]))
  7.  
  8.  
Here is what it sounds like in my head:


If Compensation Question in QuestionQuestions subform = 0 Then
Compensation Question = 0

ElseIf Compensation Question in QuestionQuestions subform = 1

And Compensation Question field in CheckMeQuestions subform = TRUE Then

End if
Slowly repeating myself:

I am looking to see if I can plug it in the Conpensation Question field on the form as...

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question])) 
  3.  
  4.  
to get a zero, wherever a TRUE is recorded for CheckMeQuestions subform data

Hope this makes sense... will search meanwhile:-)
Sep 26 '07 #11
Dököll
2,364 Expert 2GB
I am just throwing this out there while I fetch here, may have been added. I want to, within the same form, add another subform to collect other data, then look up Compensation Question field to see if values are zero, if so, load zero, but if values are higher than zero, to look up teh other subform to see if value there is set to TRUE (a checkbox field), then reflect zero for Compensation Question field:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question]))
  3.  
  4.  
Not sure how to continue this to grab the additional field, set to TRUE, to compute a zero when TRUE is found there (again, TRUE is a selected checkbox)

In therory, below looks pretty:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question])) 
  3.  
  4. OR
  5.  
  6. IIf(IsNull(CheckMeQuestions subform.Form![Compensation Question]),0,(CheckMeQuestions subform.Form![Compensation Question]))
  7.  
  8.  
Here is what it sounds like in my head:



Slowly repeating myself:

I am looking to see if I can plug it in the Conpensation Question field on the form as...

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question])) 
  3.  
  4.  
to get a zero, wherever a TRUE is recorded for CheckMeQuestions subform data

Hope this makes sense... will search meanwhile:-)
Did not find anything...


All is it is, rather than saying:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,1) 
  3.  
  4.  
I want it to say:

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf(IsNull(QuestionQuestions subform.Form![Compensation Question]),0,(QuestionQuestions subform.Form![Compensation Question])) 
  3.  
  4.  
Thus, I would get the number in ,(QuestionQuestions subform.Form![Compensation Question]) field as opposed to a 1

Does this makes sense?
Oct 13 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jeremy Weiss | last post by:
I've got a temp table that contains the fields: amountowed, amountpaid, and balanced. I've got a form that shows this information and I've set it up so that when the amountpaid field is changed it...
14
by: Allen Browne | last post by:
Subform is based on a single-table query that contains a calculated field: Amount: Round(CCur(Nz(*,0)),2) Continuous subform displays this field in a text box named Amount. As user enters new...
0
by: Del | last post by:
Thanks in advance for any help. I have a database that was created in Access 2000. Several users have been upgraded to Access 2003. Since upgrading to 2003 we have noticed that one of the...
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
1
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates...
3
by: kelley.l.turner | last post by:
Hi all, I am very new to MS Access so please bear with me! I have created a simple calculated field in my data entry form, yet when I view my data table or try to generate a report based on...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
14
klarae99
by: klarae99 | last post by:
Hello, I am working on an Access 2003 Database for inventory control. I am setting up a form (frmProducts) for the viewing and adding of product information. I have several tables that this...
1
by: Greg (codepug | last post by:
Access 2000 Using a textbox of a single form, I created a calculated field. The following code is in the Control Source for this field: =IIf(=24,+(/),/ ) The numbers that are calculated are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.