upper case letters

E

Edward

I want to save names starting with uppercase regardless how users input them.
I thought the way to do is using inputmask, somthing like
L or
C or
a
but in all of these cases it only allows the suer to input one letter. Is
there any spcial character i should use or any better way for doing this.
Ultimately I want to make first letter uppercase and the rest lowercase . is
this possibile?
 
J

Jeff Boyce

Edward

Using an input mask would be one way to accomplish that, by forcing the
users to know (or learn) that they have to start with a capital letter.

Or, in the interest of user-friendliness, you could let them enter however
they wish, and in the control's AfterUpdate event (you ARE using a form,
right?!), you could convert whatever they entered into the format you wish
to store.

Or you could forget about it altogether, and use a formatting command when
it comes time to display the data...

Good luck

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
N

Neil

Just use the KeyPress event to convert the character to uppercase as the
user types it, like this:

Private Sub MyCtl_KeyPress(KeyAscii As Integer)

If Len(Me.MyCtl.text) = 0 Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If

End Sub

You have to use the Text property of the control to get the length, because
the control's Value property is not updated until the control is updated.
The Text property gives you the text in the control before it's updated.
When the user is typing the first character, the length of the Text string
is 0; after the first character is typed, it's 1.

Neil
 
F

fredg

I want to save names starting with uppercase regardless how users input them.
I thought the way to do is using inputmask, somthing like
but in all of these cases it only allows the suer to input one letter. Is
there any spcial character i should use or any better way for doing this.
Ultimately I want to make first letter uppercase and the rest lowercase . is
this possibile?

So how would you expect to store names such as van den Steen, von
Schmidt, Henderson-Jones, McDaniels, O'Connor, etc.?
And.... some names can be capitalized differently, i.e. Mcdaniels,
O'connor, Von Schmidt.

In any event, you could use the control's AfterUpdate event to convert
whatever the user enters.
Look up UCase, LCase, and StrConv in VBA help.
 
E

Edward

Thanks, I guess my question had to be more focused on inputmask , because I'm
aware of other methods to have uppercase but how can do this using input mask
as i mentioned in my first post it seems I can't have vaiable lenght input
mask, because any of the combinations allows only 1 letter entry?
--
Best regards,
Edward


Jeff Boyce said:
Edward

Using an input mask would be one way to accomplish that, by forcing the
users to know (or learn) that they have to start with a capital letter.

Or, in the interest of user-friendliness, you could let them enter however
they wish, and in the control's AfterUpdate event (you ARE using a form,
right?!), you could convert whatever they entered into the format you wish
to store.

Or you could forget about it altogether, and use a formatting command when
it comes time to display the data...

Good luck

Regards

Jeff Boyce
Microsoft Office/Access 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