Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

append time after selecting a date from the Calendar Control.

Status
Not open for further replies.

chanman525

IS-IT--Management
Oct 7, 2003
169
US
Hey all. I have a Calendar control and 2 text boxes. The user is trying to gather information for certain days between 6:00 am of the 1st date and 6:00 am of the second.

First they click the textbox and then they select the date they want to start. This enters that date in the corresponding checkbox. They then do the same for the second.

The problem I'm having is, I want it to show 6:00:00 am right after the date in that check box, and I'm not sure how to go about it. Can anyone help?

Below is the code I have so far:


Option Compare Database
Dim datebox As TextBox


Private Sub txtenddate_Click()
Set datebox = txtenddate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(datebox) Then
ocxCalendar.Value = datebox.Value
Else
ocxCalendar.Value = Date
End If

End Sub

Private Sub txtstartdate_Click()
Set datebox = txtstartdate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = datebox.Value
Else
ocxCalendar.Value = Date
End If
End Sub

Private Sub ocxCalendar_Click()
' Copy chosen date from calendar to originating combo box
datebox.Value = ocxCalendar.Value
' Return the focus to the combo box and hide the calendar and
datebox.SetFocus
' Empty the variable
Set datebox = Nothing
End Sub


Thanks for any help you can provide.
 
What about this ?
datebox.Value = ocxCalendar.Value + 0.25

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Try this

Private Sub ocxCalendar_Click()
' Copy chosen date from calendar to originating combo box
datebox.Value = ocxCalendar.Value & " 06:00:00"
' Return the focus to the combo box and hide the calendar and
datebox.SetFocus
' Empty the variable
Set datebox = Nothing
End Sub


Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Wow, that's awesome, and easier than I thought it would be. Thanks a million.
 
Your welcome.

Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top