PC Review


Reply
Thread Tools Rate Thread

Glitched addressing, or just addressing controls incorrectly?

 
 
Jaazaniah
Guest
Posts: n/a
 
      24th Apr 2009
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.
 
Reply With Quote
 
 
 
 
Jaazaniah
Guest
Posts: n/a
 
      24th Apr 2009
On Apr 24, 9:22*am, Jaazaniah <Jaa...@gmail.com> wrote:
> 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.


On a second look, running an extra Me.Refresh in the lost focus seems
to fix the problem.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
All appointment times are glitched =?Utf-8?B?SmFtaWU=?= Microsoft Outlook Discussion 4 4th Apr 2007 03:32 PM
All-Day event times are glitched =?Utf-8?B?SmFtaWU=?= Microsoft Outlook Calendar 1 1st Apr 2007 05:52 AM
Help--IE6 internet options glitched Richard Harison Windows XP Internet Explorer 11 18th Nov 2006 12:16 AM
Glitched right click and drop-down menus. =?Utf-8?B?QWRhbSBMLiBBbGV4YW5kZXI=?= Windows XP Help 2 16th Aug 2005 05:47 AM
highly errored/glitched printer ulillillia Windows XP Print / Fax 1 24th Oct 2003 04:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:56 PM.