Time Input Mask to show "5:35pm" ONLY

  • Thread starter Thread starter Rachel
  • Start date Start date
R

Rachel

Hi there,
I am trying to get me date/time field in both the table and form to show
only 0:00pm... 5:35pm as an example.
I have tried a few different input masks the closest one I have got is
0:00\pm, however when I type the time into the field (by only typing 535) it
automatically changes to 5:35AM.
I don't need the AM option at all as all times entered will be a PM time.
Therefore I want it to automatically update as PM.
I also only want to have to type the numbers as indicated before 535. I
don't want the leading zero (05:35pm) and I dont want to have to type the :
nor p/pm.
Hope this makes sense, any help is much appreciated :)
Rachel
 
Hi there,
I am trying to get me date/time field in both the table and form to show
only 0:00pm... 5:35pm as an example.
I have tried a few different input masks the closest one I have got is
0:00\pm, however when I type the time into the field (by only typing 535)it
automatically changes to 5:35AM.
I don't need the AM option at all as all times entered will be a PM time.
Therefore I want it to automatically update as PM.
I also only want to have to type the numbers as indicated before 535. I
don't want the leading zero (05:35pm) and I dont want to have to type the:
nor p/pm.
Hope this makes sense, any help is much appreciated :)
Rachel

Private Sub UpdateToPM()
If StartTime < #12:00:00 PM# Then
StartTime = DateAdd("h", 12, StartTime)
End If
End Sub

Private Sub StartTime_AfterUpdate()
Call UpdateToPM
End Sub

In a word... add 12 hours to your date if it's before noon... like the
above... tweak to suit.
 
Thanks for your reply Piet.
I'm not sure how to assign this that particular field.
Do I use the macro builder or the properties sheet....?
sorry, trying to self teach :)
 
Thanks for your reply Piet.
I'm not sure how to assign this that particular field.
Do I use the macro builder or the properties sheet....?
sorry, trying to self teach :)

You have to do your data entry through a form. Tables have no access
to macros or modules. If you create a form, then you can add code to
the AfterUpdate event of your control, and write some code to modify
the time entered (add 12 hours).
 
Back
Top