I would like all upper case in a field........

L

LisaK

I have a field in my access database form that I would like to have all upper
case. Can someone tell me what I should do.

Thanks
 
D

Daniel Pineault

In VBA you can simply use the UCase() function

ie:
UCase("change this to uppercase")

You could tie this into a form event to change the data entered by your user
automatically. Something like

Me.ControlName = UCase(Me.ControlName)

where ControlName is the name of the control whose data you wish to have
displayed/saved in uppercase.
 
L

LisaK

Thanks, that worked.


Daniel Pineault said:
In VBA you can simply use the UCase() function

ie:
UCase("change this to uppercase")

You could tie this into a form event to change the data entered by your user
automatically. Something like

Me.ControlName = UCase(Me.ControlName)

where ControlName is the name of the control whose data you wish to have
displayed/saved in uppercase.
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.
 
J

Jerry Whittle

You have three options:

1. In all queries, forms, and reports, convert the existing data to upper
case. Something like below :
UCase([First Name Field])

2. Convert all the existing data to upper case with an update query.
UPDATE TheTable
SET TheTable.[First Name Field] = UCase([First Name Field]);

3. Set an input mask for all upper case only at table level.
CCCCCCCCCCCC

I perfer #1 myself. #3 only works for new tables. Otherwise you need both #2
and #3 to convert old data and ensure the proper case for new records.
 
K

Ken Sheridan

You can also process each keystroke so that the characters are converted to
upper case as the user enters each one. Put the following function in a
standard module:

Public Sub ConvertToCaps(KeyAscii As Integer)
' Converts text typed into control to upper case

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

End Sub

In the KeyPress event procedure of the control on the form put:

ConvertToCaps KeyAscii

Ken Sheridan
Stafford, England
 
Top