#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Date input format

Hi Guys

I have a date entry form.
One box requires a date.

I have several users using the form, each types the date in a different way.

I would like a consistant dd/mm/yyyy format. I know that access allows an
input mask to be set, can this be done in a text box on a data entry form ?

thanks
Roy


--
thanks
Roy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Date input format

Why dont you use the calendar control or a DT Picker... OR if you dont have
these controls you can build one...


You could build one. In a fresh UserForm place a textbox (TextBox1) and try
pasting the below code ...Use up/down arrows to adjust the time


Private Sub UserForm_Activate()
Me.TextBox1 = Format(Now, "dd/mm/yyyy")
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
'Date and Time Picker Use down/up arrow to change date/time.
Dim intPos As Integer, strType As String
If KeyCode = 38 Or KeyCode = 40 Then
intPos = Me.TextBox1.SelStart
strType = Application.Lookup(intPos, Array(0, 3, 6), Array("d", "m", "yyyy"))
Me.TextBox1 = Format(DateAdd(strType, (39 - KeyCode), TextBox1), "dd/mm/yyyy")
KeyCode = 0
Me.TextBox1.SelStart = intPos
End If
End Sub


--
Jacob (MVP - Excel)


"Roy Gudgeon" wrote:

Hi Guys

I have a date entry form.
One box requires a date.

I have several users using the form, each types the date in a different way.

I would like a consistant dd/mm/yyyy format. I know that access allows an
input mask to be set, can this be done in a text box on a data entry form ?

thanks
Roy


--
thanks
Roy

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Date input format

Hi Jacob

thanks for reply

am struggling a bit with this (probably beyond my abilities !)
isthere another way without date picker or something I can insert into
existing code fo rthe text box on the form ?
--
thanks
Roy


"Jacob Skaria" wrote:

Why dont you use the calendar control or a DT Picker... OR if you dont have
these controls you can build one...


You could build one. In a fresh UserForm place a textbox (TextBox1) and try
pasting the below code ...Use up/down arrows to adjust the time


Private Sub UserForm_Activate()
Me.TextBox1 = Format(Now, "dd/mm/yyyy")
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
'Date and Time Picker Use down/up arrow to change date/time.
Dim intPos As Integer, strType As String
If KeyCode = 38 Or KeyCode = 40 Then
intPos = Me.TextBox1.SelStart
strType = Application.Lookup(intPos, Array(0, 3, 6), Array("d", "m", "yyyy"))
Me.TextBox1 = Format(DateAdd(strType, (39 - KeyCode), TextBox1), "dd/mm/yyyy")
KeyCode = 0
Me.TextBox1.SelStart = intPos
End If
End Sub


--
Jacob (MVP - Excel)


"Roy Gudgeon" wrote:

Hi Guys

I have a date entry form.
One box requires a date.

I have several users using the form, each types the date in a different way.

I would like a consistant dd/mm/yyyy format. I know that access allows an
input mask to be set, can this be done in a text box on a data entry form ?

thanks
Roy


--
thanks
Roy

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
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
How do I change dates input as 20080426 to date format in Excel? Judy CS Excel Discussion (Misc queries) 7 May 8th 08 03:19 PM
input date format "ddmmyyyy" ali Excel Worksheet Functions 4 February 19th 08 11:14 AM
need help with a conditional format in regards to "date" input Fritter Excel Discussion (Misc queries) 1 September 25th 07 02:40 AM
input a date or update it based on date in another cell Doug P New Users to Excel 1 July 18th 07 11:25 PM


All times are GMT +1. The time now is 08:45 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"