Access

  • Thread starter Thread starter Judy at school
  • Start date Start date
J

Judy at school

How do you make all entries in a database field automatically capitalize the
entry?
 
To capitalize text already in a table:
UPDATE mytable SET myfield=StrConv(myfield, 3)

To capitalize text as it is being entered in a textbox on a form, put this
code in the BeforeUpdate event of the textbox:
MyTextBox=StrConv(MyTextBox, 3)

Look up the StrConv function in Access Help for more information about
string conversion possibilities.
 
To capitalize text as it is being entered in a textbox on a form, put this
code in the BeforeUpdate event of the textbox:
MyTextBox=StrConv(MyTextBox, 3)

Afterupdate, actually - BeforeUpdate will trigger an inifinite loop since
changing the value will call BeforeUpdate again.
 
If you want characters to captalize as you type, put the following code
behind the KeyPress event behind your textbox:
-----------------------------------------------------------
Dim strCharacter As String

' Convert ANSI value to character string.
strCharacter = Chr(KeyAscii)
' Convert character to upper case, then to ANSI value.
KeyAscii = Asc(UCase(strCharacter))
 
Back
Top