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

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
 
P

Piet Linden

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.
 
R

Rachel

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 :)
 
P

Piet Linden

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Setting time input mask 4
Input mask help 4
Input Mask Question 5
Time/Date input masks 3
Input Mask > 3
Input Mask - 'Evil' and 'Not Useful' 15
Input mask ????? 3
Optional Input mask 1

Top