Senin, 23 Desember 2013

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

Phucon,
Where are you viewing the NoteDt? Form, table, report, ...?
If in a form, what is the format of the text box?

What do you see if you type ? Now() into the debug/immediate window (press Ctrl+G)

Duane Hookom MVP
MS Access

________________________________
> From: saigonf7q5@yahoo.com
>
> 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

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
http://info.yahoo.com/legal/us/yahoo/utos/terms/

Tidak ada komentar:

Posting Komentar