Text Box Formatting

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

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
 
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")
 
Thanks Doug.

Douglas J. Steele said:
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")
 
An alternative idea:

x = "6/1"
?Format(Ddate(x),"mm/dd")
returns 06/01
 
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)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top