want all caps in a field

  • Thread starter George Applegate
  • Start date
G

George Applegate

This is probably a no-no, but will ask anyway.

I have a query that occasionally people edit data on or enter data
into.

I have a field that I want to always be "caps", if they enter "yes" I
want it to be YES or "no" to be "NO". If this were on a form I can do
a "build event" under code and I have some code that works.
Unforuntately, since it's just a query, if I go into design view and
click "build" it doesn't let me do it that way. Can I put in some
sort of expression, perhaps like "UCASE$"???? But I don't get how
that works.

Is there a way to make it so that if they enter something it goes in
caps in the query?

thanks,
ga

George Applegate
(e-mail address removed)
George Applegate
(e-mail address removed)
 
F

fredg

This is probably a no-no, but will ask anyway.

I have a query that occasionally people edit data on or enter data
into.

I have a field that I want to always be "caps", if they enter "yes" I
want it to be YES or "no" to be "NO". If this were on a form I can do
a "build event" under code and I have some code that works.
Unforuntately, since it's just a query, if I go into design view and
click "build" it doesn't let me do it that way. Can I put in some
sort of expression, perhaps like "UCASE$"???? But I don't get how
that works.

Is there a way to make it so that if they enter something it goes in
caps in the query?

thanks,
ga

George Applegate
(e-mail address removed)
George Applegate
(e-mail address removed)

Having a user enter data directly into a query is as dangerous as
having a user enter data directly into a table.

Create a form, using the query as it's record source.
Then have the user (or use code) open the form (not the query).
Now you can use the AfterUpdate event of the control on the form to
change the data to Upper case.

Private Sub ControlName_AfterUpdate()
Me.[ControlName] = UCase(Me.[ControlName])
End Sub
 
K

Klatuu

As fredg said, use a form.
But, you can use an Input Mask. the > in the following example causes all
letters to be converted to upper case. Use the number of question marks that
is the length of the field. For example, if the field length is 24, you
could use:
????????????????????????

Now, if you want to require the user to enter at least one character, use
 

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

Top