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 Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Text Box Formatting



 
 
Thread Tools Display Modes
  #1  
Old October 26th, 2009, 07:59 AM posted to microsoft.public.access.forms
Bill
external usenet poster
 
Posts: 330
Default Text Box Formatting

I have a text box where the user enters
text strings of the form mm/dd, but the
table field IS NOT a date per se'. What
would be the formatting specifications
for the text box so that when the user
enters something like 6/1 the format
will be changed automatically to 06/01?
I tried ##/##, but it gets changed to
#\/# and the string remains without the
leading zeros.

Thanks,
Bill


  #2  
Old October 26th, 2009, 11:22 AM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Text Box Formatting

You may have to get create and break the text down to its component parts:

Format(CInt(Left(MyTextField, InStr(MyTextField, "/") - 1)), "00") & "/" & _
Format(CInt(Mid(MyTextField, InStr(MyTextField, "/") + 1)), "00")

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Bill" wrote in message
...
I have a text box where the user enters
text strings of the form mm/dd, but the
table field IS NOT a date per se'. What
would be the formatting specifications
for the text box so that when the user
enters something like 6/1 the format
will be changed automatically to 06/01?
I tried ##/##, but it gets changed to
#\/# and the string remains without the
leading zeros.

Thanks,
Bill


  #3  
Old October 26th, 2009, 04:16 PM posted to microsoft.public.access.forms
Bill
external usenet poster
 
Posts: 330
Default Text Box Formatting

Thanks Doug.

"Douglas J. Steele" wrote in message
...
You may have to get create and break the text down to its component parts:

Format(CInt(Left(MyTextField, InStr(MyTextField, "/") - 1)), "00") & "/" &
_
Format(CInt(Mid(MyTextField, InStr(MyTextField, "/") + 1)), "00")

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Bill" wrote in message
...
I have a text box where the user enters
text strings of the form mm/dd, but the
table field IS NOT a date per se'. What
would be the formatting specifications
for the text box so that when the user
enters something like 6/1 the format
will be changed automatically to 06/01?
I tried ##/##, but it gets changed to
#\/# and the string remains without the
leading zeros.

Thanks,
Bill




  #4  
Old October 26th, 2009, 05:05 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Text Box Formatting

An alternative idea:

x = "6/1"
?Format(Ddate(x),"mm/dd")
returns 06/01

--
Dave Hargis, Microsoft Access MVP


"Bill" wrote:

Thanks Doug.

"Douglas J. Steele" wrote in message
...
You may have to get create and break the text down to its component parts:

Format(CInt(Left(MyTextField, InStr(MyTextField, "/") - 1)), "00") & "/" &
_
Format(CInt(Mid(MyTextField, InStr(MyTextField, "/") + 1)), "00")

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Bill" wrote in message
...
I have a text box where the user enters
text strings of the form mm/dd, but the
table field IS NOT a date per se'. What
would be the formatting specifications
for the text box so that when the user
enters something like 6/1 the format
will be changed automatically to 06/01?
I tried ##/##, but it gets changed to
#\/# and the string remains without the
leading zeros.

Thanks,
Bill




.

  #5  
Old October 26th, 2009, 05:45 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Text Box Formatting

On Mon, 26 Oct 2009 10:05:01 -0700, Klatuu
wrote:

An alternative idea:

x = "6/1"
?Format(Ddate(x),"mm/dd")
returns 06/01


Was that a typo, Dave? I think you meant CDate(x) rather than DDate(x)...
--

John W. Vinson [MVP]
 




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 09:26 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.