I have a VB in my ACCESS datatbase -- I DID NOT WRITE THIS because I'm new to ACCESS and know very little about VBE (I posted a question on a forum and this is what was repied to me and it works great)



Public Function TimeDuration(dblDuration As Double) As String

Const HOURSINDAY = 24

Dim strDays As String

Dim strMinutes As String



'get number of days

strDays = Int(dblDuration) * HOURSINDAY + _

Format(dblDuration, "h")



' get minutes

strMinutes = Format(dblDuration, ":nn:")



TimeDuration = strDays & strMinutes



End Function



I have to subtract two fields [field1] - [field2] that have a date and time in them from each other with the result in [field3], I was getting numbers like 50.75, 12.90 and the like. I was getting the correct hours but the minutes were wrong until I put the above VB in. Now I am having to add the fields up (I have 3 fields that have a result from a subtraction).



In the controlsource I put = SUM [FIELD3]+[FIELD6]+[FIELD8] I get #error, if I leave out SUM I get the hours and minutes in the field but not added up 2:30 4:45 8:20. What am I doing wrong.