help!! I am trying to convert numbers to a time format. I developed this in an earlier database and it worked perfectly. When i copied the module to the new database, it doesn't work.
The select case statement does not evaluate ptoperly. No matter what the value of enttime, Select Case will always go to the last (>1200) statement.
ans = MsgBox("AM?", vbYesNo)
If ans = 6 Then
'Check for length of entry (IE; under 24 is probably on the hour; 1015 is probably 10:15, etc.)
Select Case enttime
Case Is < 24
Realtime = enttime & ":" & 0
Case Is < 1000
Realtime = Left(enttime, 1) & ":" & Right(enttime, 2)
Case Is < 1200
Realtime = Left(enttime, 2) & ":" & Right(enttime, 2)
'Greater than 1159 handles special case for 12 oclock to 12:59
Case Is > 1159
Realtime = Left(enttime, 2) - 12 & ":" & Right(enttime, 2)
End Select
Else
'If not AM, it must be Pm
Select Case enttime
Case Is < 24
Realtime = enttime + 12 & ":" & 0
Case Is < 1000
Realtime = Left(enttime, 1) + 12 & ":" & Right(enttime, 2)
Case Is > 1000
Realtime = Left(enttime, 2) & ":" & Right(enttime, 2)
End Select
End If
The select case statement does not evaluate ptoperly. No matter what the value of enttime, Select Case will always go to the last (>1200) statement.
ans = MsgBox("AM?", vbYesNo)
If ans = 6 Then
'Check for length of entry (IE; under 24 is probably on the hour; 1015 is probably 10:15, etc.)
Select Case enttime
Case Is < 24
Realtime = enttime & ":" & 0
Case Is < 1000
Realtime = Left(enttime, 1) & ":" & Right(enttime, 2)
Case Is < 1200
Realtime = Left(enttime, 2) & ":" & Right(enttime, 2)
'Greater than 1159 handles special case for 12 oclock to 12:59
Case Is > 1159
Realtime = Left(enttime, 2) - 12 & ":" & Right(enttime, 2)
End Select
Else
'If not AM, it must be Pm
Select Case enttime
Case Is < 24
Realtime = enttime + 12 & ":" & 0
Case Is < 1000
Realtime = Left(enttime, 1) + 12 & ":" & Right(enttime, 2)
Case Is > 1000
Realtime = Left(enttime, 2) & ":" & Right(enttime, 2)
End Select
End If