You can force input in a control in a form to upper case by putting the
following procedure in a standard module:
Public Sub ConvertToCaps(KeyAscii As Integer)
' Converts text typed into control to upper case
On Error GoTo Err_Handler
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))
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description & " (" & Err.Number & ")", vbExclamation, "Error"
Resume Exit_Here
End Sub
Then in the KeyPress event procedure of any control whose text you want
forced to upper case put:
ConvertToCaps KeyAscii
Note that you must call the procedure in the event procedure. You cannot
make it a function and call it directly from the control's properties sheet
as you normally would when using a function as an event property.
Ken Sheridan
Stafford, England
OD said:
Thanks Ken,
I had to change some of the things that I do in the forms, this project is
just for 5 users, and I can live with the problem. One of the problems that I
had was, I don't like the way Access stores the data in a table. I was having
to use ucase([field name]) to make sure the the data was stored in upper
case. I don;t like just using the format > command, because it may be
displayed in uppercase its not stored that way. Its not a big problem, it
just bugs me.
Thanks agian for the help.
OD