473,789 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculating Time Query

13 New Member
Hi,

I'm having an issue trying to calculate time. Its okay if the value does not exceed 24 hours otherwise I get a date and hours listed. For example, I have a loop which looks through a table and adds up the time spent.

Expand|Select|Wrap|Line Numbers
  1. Dim TempCount As Date
  2.     Dim DEVCount As Date
  3.  
  4. Do
  5.  
  6.         TempCount = rst!wtime
  7.         DEVCount = DEVCount + TempCount
  8.         rst.MoveNext
  9.         i = i + "1"
  10.  
  11.     Loop Until rst!Anorder = 2
  12.  
I have two other loops looping at AnOrder 2 and 3 and calculating their totals. They seems to be okay as their total are 9h:25m and 17h:35m. But DEVCount value for anOrder 1 is: 2/1/1900 22:24:00. I guess because its exceeding a 24hour period its adding days? Is there any way of getting a figure like 37h:44m or 57h:24m??

I know a way round it would be to set DEVCount as a date and time and calculate from there but it seems very long winded for what I think should be an easy task.

Please help!!
Feb 28 '08
25 3217
Blaize
13 New Member
Hi,

Nah its not the Now() function which is causing the issue I've replaced Now() with todays date. Compiled, saved works fine as a MDB file, build to an MDE file and get: "The expression On Click you entered..." error. Tried loads of things to get round it, even a query with all the 'If' statements etc and still get the same error. Either something really basic or critically wrong which is causing it to fail. What I can't get over is the fact that it works perfectly well as a MDB file.

Cheers,
James
Mar 4 '08 #21
Blaize
13 New Member
...but in answer to your question, adding in the line of code Call MsgBox(Now()) it displays the date & time, click on, then you get the error message,

Cheers,
James
Mar 4 '08 #22
Scott Price
1,384 Recognized Expert Top Contributor
This thread indicates that using a DAO recordset with a connected backend may require that you specifically open the backend first, before running the rest of your code.

The specific command given is

Expand|Select|Wrap|Line Numbers
  1. set db = dbengine(0).opendatabase("c:\foo\bar\mydata.mdb")
Obviously you'll need to change the c:\ path to reflect your database' location.

Regards,
Scott
Mar 4 '08 #23
NeoPa
32,579 Recognized Expert Moderator MVP
...but in answer to your question, adding in the line of code Call MsgBox(Now()) it displays the date & time, click on, then you get the error message,

Cheers,
James
Ah, an answer to the question. Just what's required.

The MDE file is NOT the same as an MDB file. The rules are different. I'm not sure what they all are as I never use MDEs, but at least we now know where to look (your other tests provided little or no clues in that area).

I will need to revisit this later as I'm running late already and need to get home. Bump the thread tomorrow if I don't post something later tonight though. If I can't sort it then I'm sure we can find someone who can now we know where the issue lies.

PS. It looks as if Scott has already come up with something. let us know how you fare with this.
Mar 4 '08 #24
Blaize
13 New Member
I realise that MDE and MDB files are not the same but in terms of comiling a database you would think that if something is working as a MDB file that when you come to create an MDE file it should also work.

The query I created is held within the database whre I have the code. The backend has already connected. I did how ever add the command to test and I still get the same issue. I can't beleive such a straight forward command is causing so much of a headache?! I'm sure I've mentioned this before but I'm using Access 2000. The parameter I'm passign to the query is a Date value.
Mar 7 '08 #25
NeoPa
32,579 Recognized Expert Moderator MVP
I realise that MDE and MDB files are not the same but in terms of comiling a database you would think that if something is working as a MDB file that when you come to create an MDE file it should also work.
...
I wasn't trying to differentiate between the files, but between how (and if) the compiled project works.
You are right in that one would like to hope that they would behave in a consistent manner in both forms. However, the unfortunate fact is that they don't. There are rules to follow when converting an MDB to an MDE. You should find these explained in your help system. Never having used an MDE myself, I'm not sure what the rules are, I'm simply aware they exist.

This is all a bit similar to what happens when you upgrade from one version to another. There should be compatibility. In most cases there is not.
Mar 7 '08 #26

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

Similar topics

7
2183
by: JLM | last post by:
I have a table that has fieldA, fieldB, fieldC. I want fieldC=fieldA-fieldB. simple enough. the next record I want to be able to do the same on the new value of fieldC. I can do this with SAP ABAP/4, but have never done this using Access. I'm sure this can be done, but not sure how to go about it. thanks in advance, jlm
1
2380
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on this form. Any employee can have multiple entries in the table (key fields are EmpID and LeaveID) for multiple dates (John Doe can take 3 days annual leave, then take 3 days sick leave in any given month. I have a BeginningBalance of hours that...
3
1664
by: Paul Mendez | last post by:
Performance_Date SumOfBudget_NOI CurrYTD_BudgetNOI_Total 1/1/2004 $4,184,626.00 ? 2/1/2004 $4,484,710.00 ? 3/1/2004 $4,537,424.00 ? 4/1/2004 $4,826,850.00 ? 5/1/2004 $4,966,326.00 ? Can someone help? What I am trying to do is create a query that will end up looking like the bottom example. The above query is a calculated totals query with an...
1
4310
by: Tony Williams | last post by:
I have a table with two fields, txtvalue (a number field) and txtmonth ( a date/time field). I want to create a report that shows the difference in value between the value in txtvalue in one value of txtmonth and the value of txtvalue in another value of txtmonth and the percentage increase . For example if I have the value 1000 in 30/03/03 and the value 1100 in 30/03/04 How do I calculate the difference as 100 and the increase as 10%. I...
6
3382
by: Tony Williams | last post by:
SORRY I know we shouldn't do this but I'm desperate for an answer to this and the previous post didn't seem to get a response. I have a table with two fields, txtvalue (a number field) and txtmonth ( a date/time field). I want to create a report that shows the difference in value between the value in txtvalue in one value of txtmonth and the value of txtvalue in another value of txtmonth and the percentage increase . For example if I...
4
2187
by: luscus | last post by:
I am trying to device a formula so that when i check of a yes/no box (done) it will automatically add the time in a field called "End Time" and at the same time stamp the amount of minutes between a field "begining Time" ( which already automatically stamps the time as you enter a new record) and the field "end time" For example : If I begun the new record at 2:45 PM worked on the problem untill 3:00 PM and solved it. I would then...
3
2723
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to me and write in easier terms I would be very gratefull to all you access wizards! Here is my problem. I have a table with maybe 10 fields, It is used to imput information taken over the phone to solve patient problems in our Spanish...
5
3533
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed to 1800 stores of a national home improvement chain store. Every week I electronicaly receive an excel spreadsheet "inventory report" with 19,800 rows or records, which I import into my tblSalesData table. The table now has 10 weeks of data or...
8
4015
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006 10:00:00 AM 12:00:00 PM 120
0
9666
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
9511
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
10410
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
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
9984
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...
1
7529
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
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
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.