Thanks for responding to my question, Peter. What you say makes sense, but
that code doesn't work for me. I put your code on the line for the
textbox's OnKeyPress event, and got this error message:
"Microsoft Access can't find the macro 'Private Sub
tbx1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
The macro (or its macro group) doesn't exist, or the macro is new but
hasn't been saved.
Note that when you enter the macrogroupname.macroname syntax in an
argument, you must specify the name the macro's macro group was last saved
under."
Realizing that perhaps I don't know how to enter the code as an event, I
left [Event Procedure] on the OnKeyPress event line, and copied your code to
the VBA editor, resulting in this error message:
"The expression On Key Press you entered as the event property setting
produced the following error: Member already exists in an object module
from which this object module derives.
*The expression may not result in the name of a macro the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaulating the function event, or macro."
I've had a lot of practice with the VBA Editor in Word and Excel, but, as I
said, am a complete novice to Access VBA.
Help, please!
TIA
Peter Hibbs said:
You could just enter > in the Format property of the text box.
However, if you always want to have upper case in this field it looks
a bit messy because it only converts the text to upper case after the
user leaves the field and if they move the cursor back to the field
the text reverts to lower case again.
A better method is to enter the following code in the On Key Press
event of the text box. This converts the text to upper case as the
user enters the text.
Private Sub YourTextBoxName_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Peter Hibbs.
On Fri, 5 Jan 2007 12:58:21 -0900, "zSplash"
I am an Access novice, and use a form to fill in my tables. I want a
textbox to always be uppercase, no matter what is entered. How do I do
that?
TIA