By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,495 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,495 IT Pros & Developers. It's quick & easy.

Capital Letters in a field

P: 17
In Access, there used to be a way to Set the first letter in a field to automatically UpperCase in a form or table to override a lowercase entry. Does anyone know what that is? Thanks
Dec 1 '08 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 1,287
I know of 2 ways to do this.
One is to put code somewhere to fix what the user entered:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Text2_Exit(Cancel As Integer)
  2.     Text2 = StrConv(Text2, vbProperCase)
  3. End Sub
which will capitalize every word, whether you like it or not.

The other is to put an input mask on the field like
>A<CCCCCCCCCCCCCCCC
but that makes the first character (which is required) capitalized, and all subsequent letters (optional) small. It doesn't allow any more capital letters, but it does allow you to set a maximum length by the number of C's you put in.

Here's info on input masks:
http://www.teacherclick.com/access2003/a_5_1_2.htm
Dec 1 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
To capitalize only the first character in a textbox:

Expand|Select|Wrap|Line Numbers
  1. Private Sub TextboxName_AfterUpdate()
  2.   Me.TextboxName = UCase(Left(Me.TextboxName, 1)) & Right(Me.TextboxName, Len(Me.TextboxName) - 1)
  3. End Sub
The Exit event should not be used for this kind of thing, it will fire every time the user tabs thru the field. Use the AfterUpdate event instead;it will only fire if the data is entered for the first time or is edited.

Linq ;0)>
Dec 1 '08 #3

P: 17
Thank you ChipR This will work for what I need.
Dec 2 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.