S
sbowman
I'm trying to capture a start time and end time entered into a userform
and my program refuses to exclude the seconds!!! here's my code:
Dim chkStartTime As String
Dim chkEndTime As String
Dim StartTime As Date
Dim EndTime As Date
chkStartTime = FrmDataInput.txtStartTime.Value
chkEndTime = FrmDataInput.txtEndTime.Value
If IsDate(chkStartTime) = False Then
MsgBox "Please enter a valid start time in HH:MM AM/PM format.",
vbOKOnly
FrmDataInput.txtStartTime.SetFocus
Exit Sub
Else
StartTime = Format(chkStartTime, "hh:mm AM/PM")
End If
If IsDate(chkEndTime) = False Then
MsgBox "Please enter a valid end time in HH:MM AM/PM format.",
vbOKOnly
FrmDataInput.txtEndTime.SetFocus
Exit Sub
Else
EndTime = Format(chkEndTime, "HH:MM AM/PM")
End If
When I step through the code and add a watch to the StartTime and End
time I get hh:mm:ss AM/PM!!!
and my program refuses to exclude the seconds!!! here's my code:
Dim chkStartTime As String
Dim chkEndTime As String
Dim StartTime As Date
Dim EndTime As Date
chkStartTime = FrmDataInput.txtStartTime.Value
chkEndTime = FrmDataInput.txtEndTime.Value
If IsDate(chkStartTime) = False Then
MsgBox "Please enter a valid start time in HH:MM AM/PM format.",
vbOKOnly
FrmDataInput.txtStartTime.SetFocus
Exit Sub
Else
StartTime = Format(chkStartTime, "hh:mm AM/PM")
End If
If IsDate(chkEndTime) = False Then
MsgBox "Please enter a valid end time in HH:MM AM/PM format.",
vbOKOnly
FrmDataInput.txtEndTime.SetFocus
Exit Sub
Else
EndTime = Format(chkEndTime, "HH:MM AM/PM")
End If
When I step through the code and add a watch to the StartTime and End
time I get hh:mm:ss AM/PM!!!