Inserting Date into TextBox

  • Thread starter Thread starter Jako
  • Start date Start date
J

Jako

I have a textbox called "DateTextBox" on form "MAINFORM".

I want to put the current date into the box when the form opens
in the format dd-mm-yy.

Please can someone suggest a way to do this.


TI
 
With MAINFORM
.DateTextBox.Text = Format(Date,"dd-mm-yy")
.Show
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Depends what you mean by real time. It would be easy to have the textbox
updated upon a certain event as long as the form is still up, just a simple

With MAINFORM
.DateTextBox.Text = Format(Date,"dd-mm-yy hh:mm:ss")
End With

If you want the textbox ticking over each second, then that is much more
complex. You would need a timer. You could use OnTime, but I would
personally use the Windows timer, and have a callback to manage the updates.

I could knock you up a sample workbook if you are interested, and you give
me your email address.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Textbox value 2
VB Date Format 8
Date on UserForm? 5
Finding Date in an overseas format 20
Pasting a date to a cell from UserForm 2
Vba Date$ 1
System Dates 8
VBA in Excel 2007 date formatting 2

Back
Top