If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Time Input Mask to show "5:35pm" ONLY
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 |
#2
|
|||
|
|||
Time Input Mask to show "5:35pm" ONLY
On Jan 28, 9:44*pm, Rachel wrote:
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. |
#3
|
|||
|
|||
Time Input Mask to show "5:35pm" ONLY
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 "Piet Linden" wrote: On Jan 28, 9:44 pm, Rachel wrote: 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. . |
#4
|
|||
|
|||
Time Input Mask to show "5:35pm" ONLY
On Jan 29, 7:23*am, Rachel wrote:
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 "Piet Linden" wrote: On Jan 28, 9:44 pm, Rachel wrote: 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. . 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). |
Thread Tools | |
Display Modes | |
|
|