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

  • Thread starter Thread starter LisaK
  • Start date Start date
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
 
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.
 
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.
 
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.
 
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
 

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

Back
Top