J
Jaazaniah
I have a continuous subform for scheduling based on a list of dates in
the main form. The rest of the structure of the database has been
coded around the date and time of a given scheduled event to be in a
single field (dtDateTime). Because of the way this form is laid out,
the actual dtDateTime and dtDate (breaking out just the date portion
of dtDateTime) are hidden controls that are supposed to pick up the
master form's date for defaults.
My problem lies in the separated Time control. Here's the GotFocus/
LostFocus:
Private Sub Time_GotFocus()
Me.Time.ControlSource = ""
Me.Time.Text = Format([dtDateTime], "hh:nn")
Me.Time.SelStart = 0
Me.Time.SelLength = Len(Me.Time)
End Sub
Private Sub Time_LostFocus()
If Me.Date = 0 Then Me.dtDateTime = Forms!frmAppointmentDates!dtDates
Me.dtDateTime = CDate(Me.Date & " " & Me.Time)
Me.Time.ControlSource = "=CDate(Format([dtDateTime],""hh:nn""))"
End Sub
This was supposed to handle the fact that time isn't really a separate
field without allowing the user to alter the date in the subform.
However, to my dismay, this seems to be setting the displayed Time for
ALL displayed records as the time for the current record on LostFocus.
OnCurrent events seem to display the control correctly with no help
from code, so what am I doing wrong here? Thanks.
the main form. The rest of the structure of the database has been
coded around the date and time of a given scheduled event to be in a
single field (dtDateTime). Because of the way this form is laid out,
the actual dtDateTime and dtDate (breaking out just the date portion
of dtDateTime) are hidden controls that are supposed to pick up the
master form's date for defaults.
My problem lies in the separated Time control. Here's the GotFocus/
LostFocus:
Private Sub Time_GotFocus()
Me.Time.ControlSource = ""
Me.Time.Text = Format([dtDateTime], "hh:nn")
Me.Time.SelStart = 0
Me.Time.SelLength = Len(Me.Time)
End Sub
Private Sub Time_LostFocus()
If Me.Date = 0 Then Me.dtDateTime = Forms!frmAppointmentDates!dtDates
Me.dtDateTime = CDate(Me.Date & " " & Me.Time)
Me.Time.ControlSource = "=CDate(Format([dtDateTime],""hh:nn""))"
End Sub
This was supposed to handle the fact that time isn't really a separate
field without allowing the user to alter the date in the subform.
However, to my dismay, this seems to be setting the displayed Time for
ALL displayed records as the time for the current record on LostFocus.
OnCurrent events seem to display the control correctly with no help
from code, so what am I doing wrong here? Thanks.