PC Review


Reply
Thread Tools Rate Thread

adding Hours and Minutes in a TIME FIELD

 
 
=?Utf-8?B?QWhtZXI=?=
Guest
Posts: n/a
 
      7th Sep 2006
Dear Sir, i m working on a database in Access, which maintains the Study
hours of Students. How can i define a field in a table which can give me Sum
of Total Hours of a specific Student, or of all students At the end of the
month. How can i add Hours and Minutes of that Field in a report.


Regards
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2VvZmY=?=
Guest
Posts: n/a
 
      7th Sep 2006
"Ahmer" wrote:

> Dear Sir, i m working on a database in Access, which maintains the Study
> hours of Students. How can i define a field in a table which can give me Sum
> of Total Hours of a specific Student, or of all students At the end of the
> month. How can i add Hours and Minutes of that Field in a report.


I'm no pro, but it sure sounds like you need a related table the study time
records.

Just off the top opf my head, I would have

tblStudent
StudentID
StudentName
StudentWhateverelse...

tblTime
TimeID
StudentID
StudyTime (h:mm format)
StudyDate (m/d/yy format...unless you're not American and want to do it
the correct way...yymmdd)
TimeWhateverelse...

From this, you can make reports to total study time for all students or any
particular student.
 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      7th Sep 2006
The only time-related data type in Access is the Date type, which isn't
intended to be used for time durations: it's supposed to be a timestamp
(specific point in time). That's because, under the covers, it's an 8 byte
floating point number where the integer portion represents the date as the
number of days relative to 30 Dec, 1899, and the decimal portion represents
the time as a fraction of a day.

What you should do is store the hours in an Integer field as the number of
minutes spent studying. You can then add together the number of minutes
spent. Write your own custom function to format total minutes to hh:nn, and
you should be fine.

Function FormatMinutes(TotalMinutes As Long) As String

FormatMinutes = Format(TotalMinutes \ 60, "0") & ":" & _
Format(TotalMinutes Mod 60, "00")

End Function

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Ahmer" <(E-Mail Removed)> wrote in message
news:FF80077B-99C0-4D37-A568-(E-Mail Removed)...
> Dear Sir, i m working on a database in Access, which maintains the Study
> hours of Students. How can i define a field in a table which can give me
> Sum
> of Total Hours of a specific Student, or of all students At the end of the
> month. How can i add Hours and Minutes of that Field in a report.
>
>
> Regards



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to convert a short time field from hours to minutes Kelly Microsoft Access Queries 14 12th Jan 2009 01:08 PM
Adding/subtracting time and displaying hours, minutes, seconds NEMO Microsoft Excel Discussion 2 17th Apr 2008 06:51 AM
Adding Time (hours and minutes) bengaluru Microsoft Excel Programming 6 7th Jul 2005 07:07 PM
Change a date time field display from hours to minutes =?Utf-8?B?R2VvZmY=?= Microsoft Access Database Table Design 1 1st Mar 2005 12:30 AM
Re: Adding time (durations in hours and minutes) Chip Pearson Microsoft Excel Worksheet Functions 0 11th Aug 2003 06:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:29 AM.