exit event

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have a form that has two text boxes that are initiated as follows::

Dim Tm As Date
Tm =
Evaluate("=IF(MINUTE(TIME(HOUR(Now()),MINUTE(Now()),0))-MINUTE(TIME(HOUR(Now()),FLOOR(MINUTE(Now()),15),0))<8,TIME(HOUR(Now()),FLOOR(MINUTE(Now()),15),0),TIME(HOUR(Now()),CEILING(MINUTE(Now()),15),0))")

txtStartDate.Text = Format(Date, "mm/dd/yy")
txtStartTime.Text = Format(Tm, "h:mm AM/PM")

If I tab into the StartDate text box and type "1/22" (without the
quotes, of course) and then tab to the next field, the following
procedure runs:

Private Sub txtStartDate_exit(ByVal cancel As MSForms.ReturnBoolean)
txtStartDate.Value = Format(txtStartDate, "mm/dd/yy")
End Sub

and the text in the StartDate box changes to "01/22/06".

But if I type "8 a" in the StartTime box and then tab out of it, it
doesn't reformat even though there is a similar procedure for it

Private Sub txtStartTime_exit(ByVal cancel As MSForms.ReturnBoolean)
txtStartTime.Text = Format(txtStartTime, "h:mm AM/PM")
End Sub

When all data is entered in the form and other procedures are run, the
"8 a" is read and calculated correctly so there is no functional
problem. I would just like it to reformat it's appearance to reassure
users that they have entered what they intended. Does anyone know how
to fix this?

.



Relevant Pages

  • Re: ActiveControl again
    ... the frame exit event fires as I recall. ... This time if you tab forward from txt2 then opt1 enter is not fired though ... Private Sub OptionButton1_Enter ... WhichOptionButton ...
    (microsoft.public.excel.programming)
  • Re: Append Query Date Criteria Problem.
    ... it will be best to get it working in the query. ... INSERT INTO tblSSAttendance (SSClassID, SSClassDate, SSMemberID, ... Form Data Tab: ... Private Sub btnAddNewRecords_Click ...
    (microsoft.public.access.queries)
  • Re: ActiveControl again
    ... backtab staight from the txtbox after the frame. ... consider users wanting to tab and use accelerator keys, ... "Tom Ogilvy" wrote: ... Private Sub OptionButton1_Enter ...
    (microsoft.public.excel.programming)
  • Re: MultiTab userform question
    ... You probably do not need to change back to the previous tab to run the code ... Private Sub Multipage1_Click ... Dim myPage ... Saving the name of the new sheet. ...
    (microsoft.public.excel.programming)
  • RE: Automatically displaying text in a form
    ... "Jacob Skaria" wrote: ... Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) ... automatically display this value plus 8 years in a field on a different tab ...
    (microsoft.public.excel.programming)