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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|