PC Review


Reply
Thread Tools Rate Thread

Display date and time

 
 
=?Utf-8?B?SnVsaWFu?=
Guest
Posts: n/a
 
      24th May 2007
How can i display the date and time at real-time?Below is the script. Please
advice..

Private Sub txtTimeDAte_Change()

Dim MyDate

MyDate = Now ' MyDate contains the current system date.

txtTimeDAte.Text = Format(MyDate, "dd,mmm yy hh:mm:ss AMPM ")

End Sub


Julian
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      24th May 2007
If you want it as a call up message box. Using your macro with an added line.

Private Sub txtTimeDAte_Change()
Dim MyDate
MyDate = Now ' MyDate contains the current system date.
MyDate = Format(MyDate, "dd,mmm yy hh:mm:ss AMPM ")
MsgBox MyDate
End Sub

If you want it on the worksheet, pick a cell and type "=Now()" without the
quote marks.



"Julian" wrote:

> How can i display the date and time at real-time?Below is the script. Please
> advice..
>
> Private Sub txtTimeDAte_Change()
>
> Dim MyDate
>
> MyDate = Now ' MyDate contains the current system date.
>
> txtTimeDAte.Text = Format(MyDate, "dd,mmm yy hh:mm:ss AMPM ")
>
> End Sub
>
>
> Julian

 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      24th May 2007
There is also a keyboard shortcut for calling date and time:

Ctrl + ; for date and Ctrl + Shift + ; for time.

They did away with the clock feature in the Windows package. I used to have
it displayed in digital format in a corner of my screen. The 2003 version
has it on the status bar at the bottom now. You should be able to use one of
those that I have suggested.

"Julian" wrote:

> How can i display the date and time at real-time?Below is the script. Please
> advice..
>
> Private Sub txtTimeDAte_Change()
>
> Dim MyDate
>
> MyDate = Now ' MyDate contains the current system date.
>
> txtTimeDAte.Text = Format(MyDate, "dd,mmm yy hh:mm:ss AMPM ")
>
> End Sub
>
>
> Julian

 
Reply With Quote
 
=?Utf-8?B?SnVsaWFu?=
Guest
Posts: n/a
 
      24th May 2007
Hi JLGWhiz,

Thanks for the info,
I'm creating a userform which i want to display the date and time in the
corner.
The problem i'm facing now is that the date and time refreshes whenever i
click it.
I want it to function like a digital clock. I hope you get my idea.

Please advice

"JLGWhiz" wrote:

> There is also a keyboard shortcut for calling date and time:
>
> Ctrl + ; for date and Ctrl + Shift + ; for time.
>
> They did away with the clock feature in the Windows package. I used to have
> it displayed in digital format in a corner of my screen. The 2003 version
> has it on the status bar at the bottom now. You should be able to use one of
> those that I have suggested.
>
> "Julian" wrote:
>
> > How can i display the date and time at real-time?Below is the script. Please
> > advice..
> >
> > Private Sub txtTimeDAte_Change()
> >
> > Dim MyDate
> >
> > MyDate = Now ' MyDate contains the current system date.
> >
> > txtTimeDAte.Text = Format(MyDate, "dd,mmm yy hh:mm:ss AMPM ")
> >
> > End Sub
> >
> >
> > Julian

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      24th May 2007
> I'm creating a userform which i want to display the date and time
> in the corner. The problem i'm facing now is that the date and
> time refreshes whenever i click it. I want it to function like a
> digital clock.


Give this a try. Right-click the UserForm's ToolBox and select "Additional
Controls" from the popup menu that appears. Scroll down to "Microsoft Status
Bar Control 6.0" and select it. This will add the "Status Bar" control to
the Toolbox. Place a "Status Bar" control on your UserForm. Highlight
(select) and click on the Custom property in the Properties window and click
on the button with the "three-dots" caption. You can play around with adding
panels and what not, but for your requested option, click on the Panels tab.
One panel should already exist on the "Status Bar" by default. Change that
panel's Alignment property to 2-sbrRight, Style property to 5-sbrTime and
AutoSize property to 1-sbrSprint. Hit OK and watch the displayed time change
automatically.

Rick

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
click date/time field display calendar and validation of date /tim Smithskenpo Microsoft Outlook Form Programming 0 4th Mar 2010 08:20 PM
Bound Date/Time field to automatically display the current date Billiam Microsoft Access Database Table Design 2 20th Sep 2009 11:13 PM
TIME display in date/time field: 24 hr clock? =?Utf-8?B?RGVubmlz?= Microsoft Access Form Coding 3 9th Jan 2009 05:12 AM
Appointments display on date entered rather than date/time schedul =?Utf-8?B?TWF4UlBldGVyc29u?= Microsoft Outlook Calendar 0 28th Nov 2006 04:49 PM
DataGrid + Access-DB - display date-values grouped by date and time? Olaf Rabbachin Microsoft VB .NET 1 19th May 2005 09:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:26 PM.