Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Date Transfer to userform

Hi,
On a User From I have a text box where the user enters a date. Two queries
that I have not yet been able to sort out / find an answer - I would be
grateful if someone could assist me.

1. On a user form text box - Is it possible to restrict the user to a
particular date format? i.e. 27/05/05

2. On a userform, Once a user enters the date of their order/activity, how
do I have that date transferred to 4 text boxes to display in 4 textnoxes
the day of week, month, year and date. i.e. user enters 15/05/05 and the
text boxes are populated automatically with Monday - 15 - May - 2005

Any help would be fantastic,
Thanks,
Mickey


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Date Transfer to userform

1. Use Masked Edit (right click Toolbox, additional controls)
Set the mask property to ##/##/##

2. add a button that, when clicked, reads the date entered & populates the other boxes...

Private Sub CommandButton1_Click()

On Error GoTo FAIL

TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd")
TextBox2 = Format(CDate(MaskEdBox1.Text), "dd")
TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM")
TextBox4 = Format(CDate(MaskEdBox1.Text), "yy")

Exit Sub
FAIL:
MsgBox "Please check the date entered is valid", vbCritical, "Error"
End Sub

I do however, recommend you use yyyy (4 digit year)

Regards - Steve.


"MBlake" wrote in message ...
Hi,
On a User From I have a text box where the user enters a date. Two queries that I have not yet been able to sort out
/ find an answer - I would be grateful if someone could assist me.

1. On a user form text box - Is it possible to restrict the user to a particular date format? i.e. 27/05/05

2. On a userform, Once a user enters the date of their order/activity, how do I have that date transferred to 4 text
boxes to display in 4 textnoxes the day of week, month, year and date. i.e. user enters 15/05/05 and the text boxes
are populated automatically with Monday - 15 - May - 2005

Any help would be fantastic,
Thanks,
Mickey



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Date Transfer to userform

I don't believe the masked edit control is part of Excel.

--

Vasant


"Stevie_mac" wrote in message
...
1. Use Masked Edit (right click Toolbox, additional controls)
Set the mask property to ##/##/##

2. add a button that, when clicked, reads the date entered & populates the

other boxes...

Private Sub CommandButton1_Click()

On Error GoTo FAIL

TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd")
TextBox2 = Format(CDate(MaskEdBox1.Text), "dd")
TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM")
TextBox4 = Format(CDate(MaskEdBox1.Text), "yy")

Exit Sub
FAIL:
MsgBox "Please check the date entered is valid", vbCritical, "Error"
End Sub

I do however, recommend you use yyyy (4 digit year)

Regards - Steve.


"MBlake" wrote in message

...
Hi,
On a User From I have a text box where the user enters a date. Two

queries that I have not yet been able to sort out
/ find an answer - I would be grateful if someone could assist me.

1. On a user form text box - Is it possible to restrict the user to a

particular date format? i.e. 27/05/05

2. On a userform, Once a user enters the date of their order/activity,

how do I have that date transferred to 4 text
boxes to display in 4 textnoxes the day of week, month, year and date.

i.e. user enters 15/05/05 and the text boxes
are populated automatically with Monday - 15 - May - 2005

Any help would be fantastic,
Thanks,
Mickey





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Date Transfer to userform

I forgets? maybe it is available anyway?

I'm so used to using DEV PCs I forget what is available!

If the masked control is not available, then use a text box. I like it better that way since you can type in what ever
date format you like e.g. 13-1-05 or 13-Jan-2005 or 13/01/05.

The error handling in the sub is very broad & should catch silly entries!

(aside note: I hate date formats! to some, 1/6/04 was very cold & to others, it was 1-Jun-2004)

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ...
I don't believe the masked edit control is part of Excel.

--

Vasant


"Stevie_mac" wrote in message
...
1. Use Masked Edit (right click Toolbox, additional controls)
Set the mask property to ##/##/##

2. add a button that, when clicked, reads the date entered & populates the

other boxes...

Private Sub CommandButton1_Click()

On Error GoTo FAIL

TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd")
TextBox2 = Format(CDate(MaskEdBox1.Text), "dd")
TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM")
TextBox4 = Format(CDate(MaskEdBox1.Text), "yy")

Exit Sub
FAIL:
MsgBox "Please check the date entered is valid", vbCritical, "Error"
End Sub

I do however, recommend you use yyyy (4 digit year)

Regards - Steve.


"MBlake" wrote in message

...
Hi,
On a User From I have a text box where the user enters a date. Two

queries that I have not yet been able to sort out
/ find an answer - I would be grateful if someone could assist me.

1. On a user form text box - Is it possible to restrict the user to a

particular date format? i.e. 27/05/05

2. On a userform, Once a user enters the date of their order/activity,

how do I have that date transferred to 4 text
boxes to display in 4 textnoxes the day of week, month, year and date.

i.e. user enters 15/05/05 and the text boxes
are populated automatically with Monday - 15 - May - 2005

Any help would be fantastic,
Thanks,
Mickey







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Date Transfer to userform

"Stevie_mac" wrote in message
...
1-Jun-2004


Agreed about date formats. The above format is the one I always try to use,
and encourage others to use. There is no ambiguity.

--

Vasant




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Date Transfer to userform

Thanks for the replies, I am using the format suggested,

Cheers,
Mickey


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
Transfer info to new sheet by date onebodaciousbabe03 Excel Worksheet Functions 4 September 3rd 09 07:45 PM
transfer date to number artisdepartis Excel Worksheet Functions 4 June 19th 07 09:30 AM
Transfer data relevent to date KandK Excel Discussion (Misc queries) 7 May 1st 06 08:00 AM
Transfer data relevent to date KandK Excel Worksheet Functions 1 April 23rd 06 12:13 PM
Transfer names and date of birth payments Excel Discussion (Misc queries) 1 March 29th 06 12:17 PM


All times are GMT +1. The time now is 01:32 AM.

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"