Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default controlling date entry in a text box

We have a form where the user enters the date a sample was taken. The
date is then pasted into a worksheet column that has been formatted as
a date in the x/xx/xx format.
If the user types x/xx/xxxx (2003 not 03) the date does not appear
correctly in the worksheet.

How can I force dates to be entered to the x/xx/xx format when typed
into the data entry form?

OR

How can I check the format of the text box (txtDateSampled.text) after
it has been typed on the form to see the format, and change it to the
format of the destination worksheet column (entered with 4 digits for
the year instead of the 2 we need??

something like:

If txtdateSampled.text has 4 digits for the year then
make txtDateSampled have 2 digits for the year.
End If

I thought of using right or mid BUT could not think of a simple way to
do it other than a long complicated If statement. I know there must be
an easy way. Any help would be greatly appreciated.

Thanks,

BB



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default controlling date entry in a text box

varMyResult = Format(txtDateSampled.text,"dd/mm/yy")

Obviously you can use your own format string ("x/xx/xx" will not work
though!)

P


"captbluefin" wrote in message
...
We have a form where the user enters the date a sample was taken. The
date is then pasted into a worksheet column that has been formatted as
a date in the x/xx/xx format.
If the user types x/xx/xxxx (2003 not 03) the date does not appear
correctly in the worksheet.

How can I force dates to be entered to the x/xx/xx format when typed
into the data entry form?

OR

How can I check the format of the text box (txtDateSampled.text) after
it has been typed on the form to see the format, and change it to the
format of the destination worksheet column (entered with 4 digits for
the year instead of the 2 we need??

something like:

If txtdateSampled.text has 4 digits for the year then
make txtDateSampled have 2 digits for the year.
End If

I thought of using right or mid BUT could not think of a simple way to
do it other than a long complicated If statement. I know there must be
an easy way. Any help would be greatly appreciated.

Thanks,

BB



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default controlling date entry in a text box

Thank you's to Phobos for the quick answer!!!!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate date entry in a text box. GoBow777 Excel Discussion (Misc queries) 0 July 30th 08 08:46 PM
Creating and Controlling a User data Entry Sheet Crispy Excel Discussion (Misc queries) 0 June 2nd 06 11:11 AM
Convert Text Entry to Date Format User Excel Discussion (Misc queries) 1 November 16th 05 08:40 PM
Controlling text in an Excel worksheet sprice Excel Worksheet Functions 1 September 10th 05 12:41 AM
Controlling cell selection during data entry BrianG[_3_] Excel Programming 0 September 17th 03 09:15 PM


All times are GMT +1. The time now is 05:20 PM.

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

About Us

"It's about Microsoft Excel"