Senin, 23 Desember 2013

[MS_AccessPros] How do I format a Date/Time field to display the actual time…

 

I have been having trouble with the REPLY button or link on this web page. There's no response when I clicked on it and it displays Error On Page at the bottom left corner. So I reply the messages by using the NEW TOPIC button. I am sorry for any inconvenient this may cause.

 

Thank you all.  Originally, the format in the table's field property was set as  mm/dd/yyyy hh:nn AM/PM.    

The date then was entered by selected from a calendar through an unbound form which's shown as below:

 

With rs

          .AddNew

          !Sid = Me.txtSID

          !NoteDt = Format(Me.txtNoteDt, "mm/dd/yyyy hh:nn AM/PM"))

          !Note = Me.txtNote

          .Update

          .Close

     End With

 

But the time portion of the date was incorrect  12/23/2013 12:00 AM.

 

Now I changed the line of code from

!NoteDt = Format(Me.txtNoteDt, "mm/dd/yyyy hh:nn AM/PM") to !NoteDt = Now()

 

With rs

          .AddNew

          !Sid = Me.txtSID

          !NoteDt = Now()

          !Note = Me.txtNote

          .Update

          .Close

     End With

 

This displays the date and time correctly ONLY when the selected date is a current date. However, If the date is going to be in the past e.g. 11/23/2013, then only the time portion is correct, but the date becomes a current date 12/23/2013 2:03:56 PM, which is incorrect. ???

 

Phucon

 

 

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar