Auto-Capitalize Text in Field

Banaticus

Registered User.
Local time
Today, 07:02
Joined
Jan 23, 2006
Messages
153
I've noticed that Access has a few default "fixes" for text in a field. For instance, if I type "aBBB" then tab to the next field (whether in a table, a form or anywhere else), Access will autocorrect that to "Abbb". This is really helpful if I leave caps lock on and am trying to type names, such as "aLEX" being changed to "Alex".

Is there a way to make it auto capitalize everything in the field? I don't want to turn such a thing on for every field, just for some select fields. Perhaps some sort of self-correcting mask, whatever you would call something like that, that I could apply to various fields.
 
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

You could use the StrConv function in the AfterUpdate event of the text box that you want the keyed text to be upper case. That will let the users key the data how ever they want and when they exit the field they will see their data converted to upper case.

How to use the StrConv function to capitalize words and phrases in Access 2002

Code:
'Routine is run after tbName text box is updated.
    
Private Sub tbName_AfterUpdate()
On Error GoTo Err_tbName_AfterUpdate
    
    tbName = Trim(tbName) 'remove preceeding spaces
    tbName = StrConv(tbName, vbUpperCase) 'convert to UPPER case
    
Exit_tbName_AfterUpdate:
    Exit Sub
    
Err_tbName_AfterUpdate:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_tbName_AfterUpdate
    
End Sub

HTH
 
Is there a way to make it auto capitalize everything in the field?

You can place > in the format value of the field
 
Thanks, ghudson. Smart, that ">" thing just formats how the information is displayed -- it doesn't actually change the data.
 

Users who are viewing this thread

Back
Top Bottom