473,699 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculation in Form & Query

1 New Member
I am working on a Sales Data page of a Rent a car database where I encounter the below problem:

I have the below fields in a FORM (called Sales ) namely:
1. Odometer_Start
2. Odometer_End
3. Kilometer_Drive n
4. Extra_Kilometer
5. Total_Days
6. Extra_Kilometer _Charge

and a fied in a SUBFORM (called Car_Data) namely:
1. Kilometer_Allow ance (150 per day)

If a customer rent a car at 1000KM and returned it at 1100KM, he drove 100KM though he has 150 allowance. Here in the Extra_Kilometer field I don't want to appeare the negative value (-50), instead, it should be Zero value. Please help me to provide a code in Access.
Sep 27 '07 #1
1 1339
mlcampeau
296 Recognized Expert Contributor
I am working on a Sales Data page of a Rent a car database where I encounter the below problem:

I have the below fields in a FORM (called Sales ) namely:
1. Odometer_Start
2. Odometer_End
3. Kilometer_Drive n
4. Extra_Kilometer
5. Total_Days
6. Extra_Kilometer _Charge

and a fied in a SUBFORM (called Car_Data) namely:
1. Kilometer_Allow ance (150 per day)

If a customer rent a car at 1000KM and returned it at 1100KM, he drove 100KM though he has 150 allowance. Here in the Extra_Kilometer field I don't want to appeare the negative value (-50), instead, it should be Zero value. Please help me to provide a code in Access.
You could write an iif statement in a textbox. Something like this:
=iif(([Odometer_End]-[Odometer_Start])<=[Kilometer_Allow ance], 0, ([Odometer_End]-[Odometer_Start]-[Kilometer_Allow ance]))
I'm not sure if this value is showing up on your main form or subform, but if it is on your main form, you will have to reference Kilometer_Allow ance by referring to the subform and vice versa
Sep 27 '07 #2

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

Similar topics

4
4445
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most part, the scripts were created with http://phpcodegenie.sourceforge.net/
5
2147
by: Aravind | last post by:
Hi folks. I have a form, frmHistory, that has the following code for its On Open event. =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-= Private Sub Form_Open(Cancel As Integer) Dim NumDays As Integer
15
3600
by: Pres | last post by:
I am not an experienced programmer. I do have a question regarding workday calculations. I have 3 fields. CURDATE, NUMDAYS, CALCDATE After entering the first two fields, normally the current date and for example 10 (10 day period) I need the CALCDATE to pass me the calculated date taking into account workdays and holidays. In other words, the 10th business day. How is this done? Thanks for any help...
4
2118
by: lifang85 | last post by:
hi I have a large DB and the user will enter the values in the fields (1st form) and at the end of the day, there is another form (2nd) will get and compute all the values, calculate the diff fields to get the total. e.g: Location 4 --> school 2 --> home 5 --> others
4
3271
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 program is doing I show a window which contains a progress bar and a label. At some point during the execution the state of the calculation is changed, so I want to let the user know this. I have placed the creation of the form in a seperate thread...
7
1925
by: eric.goforth | last post by:
Hello, I'm working with a classic asp page that calls another classic asp page. The html in my calling page looks like: <form method="post" action="/includes/mypage2.asp?subtype=MyType&amp;ecd=1&amp;eid=97702"> ....Do some stuff
4
3757
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 calculation is very simple. The calculation is done in an underling query if I can call it a query or I should call it a SQL statement. It looks like a query but it is not saved as the query. The calculation in that query is very simple - ExtendedPrice:*....
1
1678
by: PeterdeHoogh | last post by:
Hi, I'm new to Access and want to write a small programme for the administration of a family confection business. For that I want to use a form in which I can easily access the order information for each of our clients. On that form it should be possible to choose clients' names from a Combo Box as well as introduce new names to the list. Also, I would want a little calculation added to the form which adds up the costs for the different services...
23
2912
klarae99
by: klarae99 | last post by:
In Access 2003 I am creating an Inventory Database from scratch. There are two tables (tblProductInformation and tblSubProducts) that I am trying to use in a queary to determine the number of Items in Stock. The SubProducts table is linked to the Product Information table by Item # (and the information is added and viewed as a form Product Information with a Sub Form Sub Products) I have a form (frmInventoryLocation) where a location is...
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8908
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4374
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
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 we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.