473,386 Members | 1,798 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,386 software developers and data experts.

calculate a complex field

1
Hi,
I have a problem in calculating a field in a table.
I have 2 tables with these fields:
1- examcode , p1, p2, P
2- examcode, f1, f2

I want to update the first table to calculate the value of "P" field. It is a bit complex, because I want it to be calculated like :
P= (p1 * f1 + p2 * f2) / (f1 + f2) if p1 <> -1 and p2 <> -1 ( if any of these two is -1 it should be omitted from the formula) (p1 , f1 and p2, f2 are the correspond fields from the two tables )
(off course there are other fields in these tables and I can't put them in one table)

I'll be glad if anyone could help me,
thanks
Oct 18 '07 #1
1 1169
epots9
1,351 Expert 1GB
Hi,
I have a problem in calculating a field in a table.
I have 2 tables with these fields:
1- examcode , p1, p2, P
2- examcode, f1, f2

I want to update the first table to calculate the value of "P" field. It is a bit complex, because I want it to be calculated like :
P= (p1 * f1 + p2 * f2) / (f1 + f2) if p1 <> -1 and p2 <> -1 ( if any of these two is -1 it should be omitted from the formula) (p1 , f1 and p2, f2 are the correspond fields from the two tables )
(off course there are other fields in these tables and I can't put them in one table)

I'll be glad if anyone could help me,
thanks
lets get this straight,first you:

get the data p1, p2, f1, f2 from the database
check to make sure that p1 and/or p2 doesn't equal -1
if they do
???
if they don't
P= (p1 * f1 + p2 * f2) / (f1 + f2)
then update the table field

is this correct?
Oct 19 '07 #2

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

Similar topics

2
by: Phil Powell | last post by:
Relevancy scores are normally defined by a MySQL query on a table that has a fulltext index. The rules for relevancy scoring will exclude certain words due to their being too short (minimum...
1
by: Building Blocks | last post by:
Hi, All I need is a simle calculate form script which contains this: A script that can handle text input, radio buttons, checkboxes, and dropdowns. Each one of these variables will contain a...
6
by: jochen scheire | last post by:
Is there a way I can calculate a field in a form based on another field in the same form. When clicking submit, both values should be posted to the next page. I want to be able to type in a value...
4
by: Jan Szymczuk | last post by:
I'm creating an MS Access 2000 database where I have a number of people entered using simple basic fields, Surname: SMITH Forenames: John DoB: 09/09/1958 Age:...
14
by: SpyderSL | last post by:
Hey, I have created an access form, in which I have a drop down with employee names. These are the steps I would like to happen: 1. A user will enter a number in FIELD A 2. The user will...
6
by: luanhoxung | last post by:
dear all!! i met the headache problem in setting value for some controls in my form. i have 2 combo box in form F1. i want to set value for some textbox in F1 when i choose value from 2 combo...
5
by: leelaramtenneti | last post by:
How to find Hyperbolic cosine of a complex number ???? i.e cosh(a+jb)= ???
2
by: viporyo | last post by:
I'm creating an Access Database 2003 for our Human Resource Dept. In the form, I will be adding a calendar wherein there will be date of hire, start date, etc. I need to be able to view the...
6
by: rrstudio2 | last post by:
I am using the following vba code to calculate the median of a table in MS Access: Public Function MedianOfRst(RstName As String, fldName As String) As Double 'This function will calculate the...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.