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

Condition in calculation

Hi
I am preparing a database for salary statements. In this the HRA should calculated depending upon the data provided in another field.

For ex:
if i had a field "HRA applicable" the data entered in that particular field should be "yes" or "no". Depending upon the data of that particular field HRA should be calculated.

Is it possible to create such condition in access.


please help me
Nov 26 '07 #1
11 2024
MikeTheBike
639 Expert 512MB
Hi
I am preparing a database for salary statements. In this the HRA should calculated depending upon the data provided in another field.

For ex:
if i had a field "HRA applicable" the data entered in that particular field should be "yes" or "no". Depending upon the data of that particular field HRA should be calculated.

Is it possible to create such condition in access.


please help me
Hi

Well, yes it is !!??


MTB
Nov 26 '07 #2
missinglinq
3,532 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. Private Sub HRA_Applicable_AfterUpdate()
  2. If Me.HRA_Applicable = "yes" Then
  3.  Me.CalculatedHRA =  'Do calculations here
  4. Else
  5.  Me.CalculatedHRA = ""
  6. End If
  7. End Sub
Linq ;0)>
Nov 26 '07 #3
My database is based on query, so where can i write this code in form or query
sorry to ask this
Nov 27 '07 #4
Zwoker
66
In your query you could add a new field something like this:
HRA_Calc: IIf([HRA_Applicable]="yes",50*0.1,0)

Obviously the 50*0.1 would be whatever you wanted the actual calculation to be. I have assumed you want a zero value when it is not true. If not, replace that final zero with default value you want when it is not true.

How's that?
Nov 27 '07 #5
I tried this, but when i try to open the form to enter data it is asking the question "HR applicable" in the beginning itself. but i want it when i enter data in that particular record.
Nov 27 '07 #6
Zwoker
66
Okay... I'm confused. You say you want the calculation in a query, but you mention a form in your last post.

Can you describe what you are doing? How does your query and form relate to each other?

If you meant that when you run the query that it is prompting you for a value of "HRA_Applicable" (or equivalent) then it would imply you don't have a field of that name, or you have a field with spaces in it's name that you need to put the square brackets around when you reference it, etc...
Nov 27 '07 #7
Its query only, For convenience in data entry i prepared form from that.
Nov 27 '07 #8
Can anybody guide me in this issue please
Dec 4 '07 #9
MikeTheBike
639 Expert 512MB
If you meant that when you run the query that it is prompting you for a value of "HRA_Applicable" (or equivalent) then it would imply you don't have a field of that name, or you have a field with spaces in it's name that you need to put the square brackets around when you reference it, etc...
Have you examined/answered/resolved the above issue ?

MTB
Dec 4 '07 #10
Hi,

Its working actually but i am not able to enter the option "yes" in query i am able to enter the option in table not in query. But the calculations are correct.

can you suggest any solution for this
Dec 7 '07 #11
Thank You Very Much... Its Working
Dec 7 '07 #12

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

Similar topics

8
by: Aspersion | last post by:
I'm building an ASP page that has a lot of text and graphics. There is a calculation facility on the page. The user enters several numbers in a form and presses a button to see the calculated...
1
by: T.S.Negi | last post by:
Data: PROJ PLAN TOTTIME UNIT A P1 10 DAY A P2 10 HOUR A P3 1 MONTH WHEN I'M DOING GROUP BY ON PROJ
0
by: anaxamandr | last post by:
Hi. I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process. I attempted...
2
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 some of the...
3
by: Douglas | last post by:
Hi, In the loop for(i=0; i< h+1; i++); if h=10 say, then is h+1 evaluated every time or, between iterations, does the for loop remember that the condition i<11 is being applied? I'm guessing...
4
by: Michiel Alsters | last post by:
Hello everybody, I hope anybody can help me. I'll try to give a brief overview of my problem. I have running a program that performs a heavy calculation. To give the user feedback what the...
4
by: vg-mail | last post by:
Hello all, I have identical design for form and report but I am getting calculation error on form and everything is OK on report. The form and report are build up on SQL statement. The...
5
by: The alMIGHTY N | last post by:
Hi all, Let's say I have a simple math formula: sum (x * y / 1000) / (sum z / 1000) I have to do this across 50 items, each with an x, y and z value, when the page first loads AND when a...
3
by: mattmao | last post by:
Okay, I was asked by a friend about the result of this limit: http://bbs.newwise.com/attdata/forumid_14/20070922_fe7f77c81050413a20fbDWYOGm7zeRj3.jpg Not n->zero but n-> + infinite I really...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.