473,405 Members | 2,349 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,405 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 1170
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.