Uppercase only fix and prevent

B

Bob Quintal

One complete fool wrote in
I have an Access 2003 database.

There is one field which must always be all uppercase.

I have just discovered that about 3500 records have been
entered in mixed case.

Is there a way to automatically change the case without the
need to retype manually?

And is there a way to prevent this from happening so that no
matter what is typed only uppercase will be entered into the
field?

Thank you
Sure. Write a query that does an update of fieldname to UCASE
(fieldname)

In the AfterUpdate event of the control for this field, on the
form used for data entry, just put me.txtboxname = ucase
(me.txtboxname) - change txtboxname to the real name for that
control.
 
O

One complete fool

I have an Access 2003 database.

There is one field which must always be all uppercase.

I have just discovered that about 3500 records have been entered in
mixed case.

Is there a way to automatically change the case without the need to
retype manually?

And is there a way to prevent this from happening so that no matter
what is typed only uppercase will be entered into the field?

Thank you
 
D

Douglas J. Steele

You could always use an Update query:

UPDATE MyTable
SET MyField = UCase([MyField])

To ensure that it's always in upper case, use the UCase function in the
form's BeforeUpdate event. If you're not using a form, there's nothing you
can do.
 
G

Graham Mandeno

Hi Bob

Actually, strange as it may seem, it IS the AfterUpdate event you should
use.

You cannot change the data in a control during its BeforeUpdate event
because you get the following message:
The macro or function set to the BeforeUpdate or ValidationRule property for
this field is preventing Microsoft Access from saving the data in the field.
 
M

missinglinq via AccessMonster.com

Graham is right, you have to use the textbox's AfterUpdate event, not the
BeforeUpdate, for the reason he stated. You can, as Doug stated, use the
BeforeUpdate event of the Form! Ain't Access grand?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
B

Bob Quintal

Hi Bob

Actually, strange as it may seem, it IS the AfterUpdate event
you should use.

You cannot change the data in a control during its
BeforeUpdate event because you get the following message:
The macro or function set to the BeforeUpdate or
ValidationRule property for this field is preventing Microsoft
Access from saving the data in the field.
I know that. You can use the beforeUpdate, with the control.text
property, which is only available while the control has focus. I've
found this to be a much more complex situation, with possibilities
for error.

And it is possible to use the BeforeUpdate of the Form, but again
you need to ensure that the focus is not on the control you are
trying to uppercase, which can happen
 

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

Similar Threads

COMBO BOX vs Uppercase 6
Changing Case 2
Entering all data in UpperCase 7
Validation error message 2
Change cell range to Uppercase 1
force uppercase 4
Auto Uppercase 5
UCase function and default entry... 4

Top