Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Adding Up Seconds
Richard Rost 
      
18 years ago
Q: Hi I am trying to work with a field in a table called CALL DURATION which is a Date/Time field in the format HH:MM:SS. I am trying to work out and then add up the total seconds;
I have put the following in a query field;
total seconds: (Val(Left([CALL DURATION],2)*3600)+Val(Mid([CALL DURATION],4,2)*60)+Val(Right([CALL DURATION],2)))
I would like to 'Sum' the total seconds but every time I try I keep getting the 'Data Type Mismatch..'error message. I don't understand as when I run the query (without the Sum on) the 'total seconds' field appears to be a number and not text. Help I'm going mental!!
Thanks in anticipation
Clare


A: Clare... Left, Right, and Mid are TEXT functions. You can't use them on a time/date without converting the time to a text value first… which you probably don't want to do.

If you want to convert hh:nn:ss into seconds, then you should use the TIME AND DATE functions, in this case Hour() Minute() and Second().

Let's say you have a time in the field T.

Set up three new calculated query fields:

H: Hour([T])
M: Minute([T])
S: Second([T])

Now, with a little math you can figure out how many seconds that represents:

TotalSeconds: ([H]*60*60)+([M]*60)+([S])

Piece of cake.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/22/2026 9:53:44 AM. PLT: 0s