473,491 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to calculate a field based on the value of the other field

14 New Member
I have an access form. In the form, it co ntains 3 fields : Type, hours, and Amount.

Field "Type" is a combo box and it contains 2 values: Standard and Rush
Field " Hours" is just a numeric field
Field "Amount" is a currency field.

What I try to do is if the user select Standard from the field "Type", the field "Amount" will be automatically populate by: 24*[hour], else if the type is "Rush" then the Amount field will be as 26*[fhours]

I am not to sure how to start and I would appreciate for any help. Michelle.
Dec 10 '06 #1
3 2417
ADezii
8,834 Recognized Expert Expert
I have an access form. In the form, it co ntains 3 fields : Type, hours, and Amount.

Field "Type" is a combo box and it contains 2 values: Standard and Rush
Field " Hours" is just a numeric field
Field "Amount" is a currency field.

What I try to do is if the user select Standard from the field "Type", the field "Amount" will be automatically populate by: 24*[hour], else if the type is "Rush" then the Amount field will be as 26*[fhours]

I am not to sure how to start and I would appreciate for any help. Michelle.
'This should work nicely:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboType_AfterUpdate()
  2.   Select Case Me![cboType].Value
  3.     Case "Rush"
  4.       Me![txtAmount] = 26 * Me![Hours]
  5.     Case "Standard"
  6.       Me![txtAmount] = 24 * Me![Hours]
  7.     Case Else
  8.   End Select
  9. End Sub
Dec 10 '06 #2
nico5038
3,080 Recognized Expert Specialist
I nice workaround might be to change your combobox source into a two field valuelist like:
24,"Standard",26,"Rush"
Now also change the number of columns to 2 and set the columnwidth to 0 (zero) as that's suppressing the first column with the 24 and 26.
Also make sure that the bound column is set to 1.

Now the control sorce of field txtAmount can be set to:
=NZ([Type])*[Hours]

Idea ?

Nic;o)
Dec 10 '06 #3
Michelle Anderson
14 New Member
Thanks guys . It works wonderfully. Michelle
Dec 10 '06 #4

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

Similar topics

2
3994
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...
53
5652
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
6
7278
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...
3
8204
by: carla | last post by:
I am using Access 2000 and have a table, tblCurrent. That table contains several fields - three of those fields are , and . What I want to accomplish in my data entry form, is first entering the...
6
14429
by: rohayre | last post by:
Im a long time java developer and actually have never done anything with java scripting. I'd like to write a short simple script for calculating a date in the future based on today's date and a...
14
4677
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...
4
3156
by: Simon Gare | last post by:
Hi all, need to do a simple form calculation in asp based on values in 2 other field and enter that data into table. (field)SubTotal + (field)VAT = (Result in field)GrandTotal Any resources...
5
2614
by: Michael | last post by:
Hi. I need dinamically calculate input text field based on parent static TD before showing content of input. Please, advice. Michael
6
5237
by: kodt | last post by:
I have a form with 4 text input fields. The last one is the total of the previous three fields and should automatically calculate this value when a user enters data into any of the first 3. ...
6
4076
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
7112
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
7146
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
7183
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
5448
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
4573
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.