siouxprincess
Registered User.
- Local time
- Today, 10:10
- Joined
- Jun 27, 2007
- Messages
- 11
This code worked fine in Access 2003 to convert time into the format 00:00:00, but it is not working in Access 2007. I need help with how to modify this code.
Function ConvertMinutes(minutes As Variant) As String
If IsNull(minutes) Then
ConvertMinutes = "N/A"
Else
Dim dblMinutes As Double
dblMinutes = CDbl(minutes)
Dim hours As Long
Dim min As Long
Dim seconds As Long
hours = Int(dblMinutes / 60)
min = Int(dblMinutes - (hours * 60))
seconds = (dblMinutes - Int(dblMinutes)) * 60
Dim time As String
If hours < 10 Then
time = "0" & CStr(hours)
Else
time = CStr(hours)
End If
If min < 10 Then
time = time & ":" & "0" & CStr(min)
Else
time = time & ":" & CStr(min)
End If
If seconds < 10 Then
time = time & ":" & "0" & CStr(seconds)
Else
time = time & ":" & CStr(seconds)
End If
ConvertMinutes = time
End If
End Function
Function ConvertMinutes(minutes As Variant) As String
If IsNull(minutes) Then
ConvertMinutes = "N/A"
Else
Dim dblMinutes As Double
dblMinutes = CDbl(minutes)
Dim hours As Long
Dim min As Long
Dim seconds As Long
hours = Int(dblMinutes / 60)
min = Int(dblMinutes - (hours * 60))
seconds = (dblMinutes - Int(dblMinutes)) * 60
Dim time As String
If hours < 10 Then
time = "0" & CStr(hours)
Else
time = CStr(hours)
End If
If min < 10 Then
time = time & ":" & "0" & CStr(min)
Else
time = time & ":" & CStr(min)
End If
If seconds < 10 Then
time = time & ":" & "0" & CStr(seconds)
Else
time = time & ":" & CStr(seconds)
End If
ConvertMinutes = time
End If
End Function