A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old January 29th, 2010, 04:44 AM posted to microsoft.public.access.tablesdbdesign
Rachel
external usenet poster
 
Posts: 187
Default 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  
Old January 29th, 2010, 06:34 AM posted to microsoft.public.access.tablesdbdesign
Piet Linden[_2_]
external usenet poster
 
Posts: 280
Default 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  
Old January 29th, 2010, 02:23 PM posted to microsoft.public.access.tablesdbdesign
Rachel
external usenet poster
 
Posts: 187
Default 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  
Old January 29th, 2010, 10:59 PM posted to microsoft.public.access.tablesdbdesign
Piet Linden[_2_]
external usenet poster
 
Posts: 280
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.