Input Masking

L

LEM17

I am looking for a way to limit people from entering info in all CAPS. I
would like some help with the way to do this when the guys are entering
corporation names into our database via a form. Our client table is made up
of individuals and corporations. The >L<??????????? command does not work
for 2 consecutive words that should be capitalized. Thanks in advance for
your guidance.
 
J

John W. Vinson

I am looking for a way to limit people from entering info in all CAPS. I
would like some help with the way to do this when the guys are entering
corporation names into our database via a form. Our client table is made up
of individuals and corporations. The >L<??????????? command does not work
for 2 consecutive words that should be capitalized. Thanks in advance for
your guidance.

Input masks and validation rules are not going to be able to handle this well.
Some corporate names *are* in all caps, legitimately; most use mixed case
(you'ld want to enter J. P. Morgan rather than J. p. morgan surely!)

I'd suggest using code in the Form's BeforeUpdate event (and yes, you must use
a form; tables have no usable events) to see if the user is typing all caps.
E.g.

Private Sub txtCompanyName_BeforeUpdate(Cancel as Integer)
Dim iAns As integer
If StrComp(Me!txtCompanName, UCase(Me!txtCompanyName), 0) = 0 Then
iAns = MsgBox("Should this be in ALL CAPS?", vbYesNoCancel)
Select Case iAns
Case vbYes ' do nothing
Case vbNo ' let them edit
Cancel = True
Me!txtCompanyName.SetFocus
Case vbCancel ' start over
Cancel = True
Me!txtCompanyName.Undo
End Select
End Sub

John W. Vinson [MVP]
 

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