Forcing Caps

G

Guest

I'm using Access 2002 and Jennings' book, Using ....

I want to force all caps to be stored in the first and lastname fields of my
Author table -- and also allow for hyphens in the lastname field. I've tried
using a combination of symbols from Jennings' table in the Input Mask and
Format Field Properties. I thought I got it working in my Author table (only
caps displayed), but when I LookUp the Author name not in the Audio
Collection table (created using the Data Type LookUp Wizard), the names are
not capitalized. The same thing in any form I create.

I'm sure I'm missing something obvious, but can't figure it out. Thanks for
any help.
 
G

Guest

Please do not post duplicate "Please do not post duplicates in multiple
groups." messages!

I posted the first erroneously in the Forms Design group and thought better
of it.
 
D

Dirk Goldgar

Minding said:
I'm using Access 2002 and Jennings' book, Using ....

I want to force all caps to be stored in the first and lastname
fields of my Author table -- and also allow for hyphens in the
lastname field. I've tried using a combination of symbols from
Jennings' table in the Input Mask and Format Field Properties. I
thought I got it working in my Author table (only caps displayed),
but when I LookUp the Author name not in the Audio Collection table
(created using the Data Type LookUp Wizard), the names are not
capitalized. The same thing in any form I create.

I'm sure I'm missing something obvious, but can't figure it out.
Thanks for any help.

The Format property only governs the way text is displayed, not how it
is stored. There are several ways to approach this problem:

1. Use an input mask, beginning it with the character '>'.

The drawback to this approach is that you have to specify a mask
character for each character that might be entered in the field. A mask
of ">C" allows at most 1 character to be entered. A mask of
">CCCCCCCCCC" allows up to 10. Specifying fixed-length input masks is a
pain for relatively free-form data like names.

2. Convert the text in the field to upper case immediately after it has
been entered. For this you can use the control's AfterUpdate event,
with an event procedure like this:

'----- start of example code -----
Private Sub LastName_AfterUpdate()

With Me.LastName
.Value = UCase(.Value)
End With

End Sub
'----- end of example code -----

The only disadvantage of this approach that I can think of is that
the user doesn't see the upper-case letters while typing. I still favor
this approach, when it's necessary for a field to be upper case.

3. Convert the letter keystrokes to upper case as they are typed. For
this you can use an event procedure in the control's KeyPress event,
like this:

'----- start of example code -----
Private Sub LastName_KeyPress(KeyAscii As Integer)

KeyAscii = Asc(UCase(Chr(KeyAscii)))

End Sub
'----- end of example code -----

Many people like this approach.

Given these various approaches to forcing upper case, I still have to
ask, why? Why not let people enter names in mixed case? They're
prettier and easier to read that way. If you're afraid they won't use
mixed case, you can check in the control's AfterUpdate event to see if
they used all lower or all upper case, and correct the case to "proper
case" using the StrConv function if they did. Of course, for some names
that won't give the correct capitalization, but you can leave it to the
user to correct that. You can even make some effort to trap many such
cases in code.
 
J

Jeff Boyce

I'm with Dirk on this. Proper/mixed case is much easier to read.

If you are trying to force all UPPER CASE name information into your
database, I have to wonder if you are anticipating how you would use the
name information. If, for example, you intend to use all upper case on
mailing labels, a simple query will allow you to (temporarily) convert
Firstname and Lastname (and StreetAddress and City/State/Zip) to upper case,
without messing with your ability to use something like:

Dear John

on the inside letter...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Bingo! See reply to Dirk ... and thanks.

Jeff Boyce said:
I'm with Dirk on this. Proper/mixed case is much easier to read.

If you are trying to force all UPPER CASE name information into your
database, I have to wonder if you are anticipating how you would use the
name information. If, for example, you intend to use all upper case on
mailing labels, a simple query will allow you to (temporarily) convert
Firstname and Lastname (and StreetAddress and City/State/Zip) to upper case,
without messing with your ability to use something like:

Dear John

on the inside letter...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Thanks, Dirk.

It's the user's choice, not mine; though in thinking about it, they only
care on printing labels ... hmmm.
 
R

Rick Brandt

Jeff said:
I'm with Dirk on this. Proper/mixed case is much easier to read.

If you are trying to force all UPPER CASE name information into your
database, I have to wonder if you are anticipating how you would use
the name information. If, for example, you intend to use all upper
case on mailing labels, a simple query will allow you to
(temporarily) convert Firstname and Lastname (and StreetAddress and
City/State/Zip) to upper case, without messing with your ability to
use something like:

Forcing to all caps can makes sense if your back end is case sensitive. If you
allow mixed case then you have to use the less efficient method of applying the
UCase() function to both the field being tested and the criteria being entered.
Otherwise you have to explain to users that they are not going to find "JOHN
SMITH" if they enter "John Smith".

Our primary back end (UDB400) is case sensitive and its a royal PITA.
 

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