Access

J

Judy at school

How do you make all entries in a database field automatically capitalize the
entry?
 
T

tedmi

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.
 
J

John W. Vinson

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.
 
E

Evan Keel

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))
 

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

Top