Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

empty calc field shows error

Status
Not open for further replies.

darlek

Technical User
May 9, 2001
27
GB
empty calc field shows <error how do i get it to show o or blank.
regards
 
We need a little more information. Is it a field on a form, or report. If on a form, is it 'defined' or is it an edit field that has code attached to it?

I used empty edit fields for many calculations I want to show the user. To avoid the <error> notice I set the field to only do the calculation if all the elements are present. For example, if I have three fields 'Cost', SquareFt', and 'CostPerSqFt' where the last field is a calculation based on the first two, I will attach the following code to the event I'm using to fire the calculation (i.e. arrive method or whatever):

Code:
if cost.value = &quot;&quot; or SqareFt.value = &quot;&quot;
   then return
     else CostPerSqFt.value = (Cost.value/SquareFt.value)
endif



Mac :)

&quot;Strange women lying in ponds and distributing swords is no basis for a system of government&quot; - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
You are right in your assumption it is an undefined field on a form which shows a runtime calc for information, as the user enters values the calc operates to show the current value. If i place your code in arrive will it continually change or would it be better in new value.The calc is totmetres1/Sum([:WORK:MACHDATA\MACH.Dw]) user imputs metres down the table totmetres is a calc of the sum of metres so the answer calc gives a changing result as metres are added. Regards
 
Then you might want to include the code in the depart method of the meteres field.


Langley Mac :)

&quot;Strange women lying in ponds and distributing swords is no basis for a system of government&quot; - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
thank you, you wouldn't by any chance have a solution for another little problem, I log the daily production of a production plant and i get production in items per machine i.e. mach1 20kgs, mach2 20 kgs mach3 20 kgs mach1 20kgs, i am now trying to find a way to calculate in a form field the individual kg totals per machine i.e mach1=40 kgs etc . i can get the answer by useing a report with a group band on field mach, but i really need to find a way to calculate the answer so that the daily mach production can be kept.Regards
 
I'm not sure I understand what you want to do. Are you saying that you want a field on the form that keeps a running total of kgs for an individual machine? Sort of a quick reference?

Mac :)

&quot;Strange women lying in ponds and distributing swords is no basis for a system of government&quot; - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
I run a query which gives daily production this gives every roll produced in 24 hours by 50 machines. The query database gives rollno machineNo and weight. I now want a quick reference calc which will give the total weight per machine, i could do a query by machine with calc sum weight but this would entail 50 queries ( i think)i wondered if there was a way to do a tcursor calc ( or any other way ) to give the result in a field per machine, the form that is a production report has other calculated fields relevant to each machine and i want to store the daily produced weight by each machine. Regards
 
In a query, place a check (not checkplus) in the Machine field, then type CALC COUNT ALL in the Weight field. You can use a date range, but don't check any other fields.

Mac

Mac :)

&quot;Strange women lying in ponds and distributing swords is no basis for a system of government&quot; - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
Sorry - I meant CALC SUM ALL!

It's early and I haven't had my coffee...


Mac :)

&quot;Strange women lying in ponds and distributing swords is no basis for a system of government&quot; - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
HI, I understand what you are doing here but what i cannot seem to work out is how to place the weight total obtained in the resultant answer table into a field box on a form.i.e form has other details about each machine so form has fields for - quality / orderno / total weight. for each individual machine.The quality and orderno are obtained from other tables . The problem i have is now that i have the total weight for each machine i do not know how to get the weight figure from the answer table into the field box for the machine,Regards
 
Is this a data entry form, or a display type form. What I mean is, is someone going to be editing the values, or does it just pop-up with everything neatly in place to show what's been done for the day?

Mac :)

&quot;Strange women lying in ponds and distributing swords is no basis for a system of government&quot; - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
hi. this is just a data display form, the form is opened automatically after a qbe produces the current amount of production and shows the values for each machine , the program already works and i use an iif statement to get the count of rolls for each machine which i then multiply by the average weight to give the results on the form. this is not very accurate .At 8.00am the form automatically zeros to start the next 24 hours worth of production records. the idea was to store the daily production weights in another table so that a simple record is kept of daily machine production.Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top