A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Page Layout
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Input mask for form fields in Word



 
 
Thread Tools Display Modes
  #1  
Old April 7th, 2009, 08:06 PM
Lee S. Lee S. is offline
Member
 
First recorded activity by OfficeFrustration: Feb 2005
Posts: 9
Default Input mask for form fields in Word

Hi,
I was asked to create a new form that has a number of date fields. The boss wants to be able to type 050209 and have it appear as 5/2/09. I know that input masks are available in MS Access, but how do I put something like this in a form field in MS Word? If anybody has any suggestions, I'd really appreciate it.

Thanks,

Lee
  #2  
Old April 7th, 2009, 10:42 PM posted to microsoft.public.word.pagelayout
Greg Maxey[_2_]
external usenet poster
 
Posts: 649
Default Input mask for form fields in Word

Lee,

You now need to get your boss to change his or her mind. 050209 is not a
valid date format. Word sees this as a long value and would return a
seemingly odd result. You could show this to your boss:

Sub Test()
Dim oDate as Date
oDate = "050209"
Msgbox Format(oDate, "m/d/yy")
End Sub

AFIAIK (and it would be clunky), all you could do is use a text field to
enter the value 050209, then convert it to a valid date format, then format
that valid date as the boss desires, then replace the text entered with the
formatted date.


Lee S. wrote:
Hi,
I was asked to create a new form that has a number of date fields.
The boss wants to be able to type 050209 and have it appear as
5/2/09. I know that input masks are available in MS Access, but how
do I put something like this in a form field in MS Word? If anybody
has any suggestions, I'd really appreciate it.

Thanks,

Lee


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



  #3  
Old April 9th, 2009, 01:22 AM posted to microsoft.public.word.pagelayout
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Input mask for form fields in Word

Hi lee,

I believe I've already answered this for you at: http://www.tek-tips.com/viewthread.c...1541593&page=1

If you're going to post the same query in multiple forums, you should say so. - and acknowledge whatever advice you've already
received.

--
Cheers
macropod
[MVP - Microsoft Word]

PS: A simpler form of the Function I posted at tek-Tips is:
Function StrToDate(FFname As String) As String
Dim TmpStr
TmpStr = ActiveDocument.FormFields(FFname).Result
StrToDate = TmpStr
If Len(TmpStr) = 6 Then
If CDate(Left(TmpStr, 2) & "/" & Mid(TmpStr, 3, 2) & "/" & Right(TmpStr, 2)) Then _
StrToDate = Format(CDate(Left(TmpStr, 2) & "/" & Mid(TmpStr, 3, 2) & "/" & Right(TmpStr, 2)), "DD-MM-YYYY")
End If
End Function


"Lee S." wrote in message ...

Hi,
I was asked to create a new form that has a number of date fields. The
boss wants to be able to type 050209 and have it appear as 5/2/09. I
know that input masks are available in MS Access, but how do I put
something like this in a form field in MS Word? If anybody has any
suggestions, I'd really appreciate it.

Thanks,

Lee




--
Lee S.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:27 AM.


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