Hi friends
I have StartDate and EndDate at my form. I have found a Function GetElapsedTime(interval) which calculate hours & minutes when I give StartDate and Enddate.
At my form TimeSpent is a field and its Control Source is Function GetElapsedTime(interval)
=GetElapsedTimenew([Date2]-[Date])
Now I have to calculate TimeSpent with HourRate. I can't do it bcoz Function.
Can anybody help me.
Thanks
Irshad Ahmed
7 1099
You could have another control with its control source being - =[TimeSpent] * [HourRate]
Personally I would do all the calculations in a query, including your TimeSpent field.
Dear Seth
It is not working. When I try to calculate it gives message.
"#Error".
I also try to run it through query but no result only gives this message.
When I enter Date1 and Date2....TimeSpent calculation is OK.
but it only shows at Form as running sum and does not save in the table. so TimeSpent field in table remain empty.
I assume that TimeSpent control source is a function, not a field, so it is not calculating.
Any more idea or guidance/suggestion. Thanks
You shouldn't store calculated values in tables anyway. Let me see if I've got your project correct. You have Date1, Date2, and HourRate which are entered by the user and then you want TimeSpent and Pay to be calculated? If this is correct, then do it in a query and then bind your form to the query. - SELECT Date1
-
, Date2
-
, HourRate
-
, GetElapsedTimenew(Nz([Date2], 0) - Nz([Date1], 0)) As TimeSpent
-
, Nz(TimeSpent, 0) * Nz(HourRate, 0) As Pay
-
FROM Table_Name
You will need to add any other fields that you need and put in your table name and you should be good to go.
Dear Seth
I tried your lines but result is same #Error
My project is attached. I will be really thankful if you please look at that where I am making mistake.
Please just post the SQL code as I don't open attachments.
OK... here is my query which I open in design mode but for you it is in SQL mode
SELECT [User Time].DATE, [User Time].DATE2, [User Time].RATE, GetElapsedTimenew(Nz([Date2],0)-Nz([Date],0)) AS TimeSpent, [Rate]*[TimeSpent] AS Amount
FROM [User Time];
I will appreciate if you plz open my attached query, it is bcoz i normally make query in query mode not in SQL.
Thanks
How you open the query doesn't change anything and the design mode is just Access putting an interface on the SQL code, which is what actually runs.
I notice a few different possible issues. First, Date is a reserved word in Access, and while it is allowed to be used as a field name, it can sometimes cause issues. I would recommend changing to something like Date1 or anything else that isn't a reserved word. You can Google what those are. Second, you don't have the Nz() function around either part of the calculation for Amount. Try adding those and see what happens.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: beavenour |
last post by:
I am looking for some help creating a more universal function out of
this lame attempt at javascript. I have little experience with
javascript and want to be able to universalize this function. ...
|
by: Simon Gare |
last post by:
Hi,
I need to calculate a total based on fields in a repeat region, these values
are stored in an SQL db, all are numeric and written in ASP.
fields are
TOTAL_COST VAT ...
|
by: jimmyg123 |
last post by:
Hi,
I'm trying to do something similar. This is my javascript
<script type='text/javascript'>
function totalise(price,total)
{
var qty = window.document.getElementById('qty').value;
var...
|
by: 06mca30 |
last post by:
How to calculate total no of hits for my home page?
|
by: tonyhhisc |
last post by:
This script calculates the total "listing_fee" based on the price that the user inputs into the "price" field. It works in Firefox but IE says "OBJECT NOT FOUND" please help me debug this, It's...
|
by: kaavitha |
last post by:
I am using checkbox list in my project,
item1 250
item2 200
item3 300
item4 250
item5 300
so after checking ,the selected items should be redirected to another page with their cost and the...
|
by: John Torres |
last post by:
how do you calculate total time hours? I have sub total hours for each day and I've been trying to total all the hours. I'm getting odd numbers.
Thanks.
John
|
by: Jackwaters |
last post by:
I have a problem in that I have an arrayList called pizzaOrders which contains a number of pizza orders. The pizza orders contain information like names, addresses, total price for orders and the...
|
by: amek000 |
last post by:
<script language="javascript">
function calcvaluesArr(){
var txts = document.getElementsByName('textfield23');
var aTotal=0;
for (var i = 0; i < txts.length; i++)
...
|
by: idealsavran |
last post by:
hello..
How can I calculate the total of pages for all file(pdf,word,excel,txt...) types in a directory with c#?
please... help!!!
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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...
|
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...
|
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: 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...
|
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,...
|
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...
| |