<snip>
Function GetElapsedTime(interval) 'This line declares the name of the function and allows you to call it from anywhere in the database, instead of typing the name in over and over.
Dim totalhours As Long, totalminutes As Long 'Declare the variables and their data type (long integer).
Dim days As Long, hours As Long, minutes As Long 'Same as above
days = Int(CSng(interval)) 'This line loads the interval into the days variable. The "Int" part returns an integer (in-6.773 out-7) and the CSng forces a single precision number (a bit redundant, if you ask me). The (interval) is the input from a form, etc., in days.
totalhours = Int(CSng(interval * 24)) 'Same as above, but multiplies the input by 24 to get the hours in a day
totalminutes = Int(CSng(interval * 1440)) 'Same, but multiplied by 1440 to get the total minutes in a day.
hours = totalhours Mod 24 + (days * 24) 'Here, the totalhours variable is divided by 24 and the remainder of the division process is taken and added to days*24 to get the actual number of hours. (The Mod operator is also redundant, as you've already stripped the "days" variable to an integer.
minutes = totalminutes Mod 60 'Same as above, essentially.
GetElapsedTime = hours & " " & "Hours and" & " " & minutes & " " & "Minutes" 'This will load the variable GetElapsedTime (or a form control, perhaps) with the result of the equation above. So, if you chose 7.2 for the interval, this is what would happen:
days = 7
totalhours = 168
totalminutes = 10080
hours = 175
minutes = 168
GetElapsedTime = 175 Hours and 168 Minutes 'The & concatenates a string together with other strings or variables or whatever. However, this is a weird way of doing things. You should try
Dim h, m, Diff
DateDiff ("h", SomeDateandTime, Now())
DatePart ("n", Now())
Diff = h & " Hours and " & m & " minutes"
'Granted, this won't return the exact number of minutes elapsed, but it will give you an approximation, and if you are calculating from midnight on the date, you're fine.
Good luck!