Upper Case

P

Paul Dennis

I am entering a name in a Field, i.e. john smith and I want to format it so
that the first letter of each word is forced into capitals, however I also
want the field to accept numbers?

Any help would be welcome?
 
J

Jeff Boyce

Paul

?You have persons whose names are numbers?

If not, why are you entering numbers and names in the same field? This
violates basic relational design.

Regards

Jeff Boyce
<Office/Access MVP>
 
J

Jeff Boyce

Paul

Take a look at StrConv() function, using the "Proper" case setting (3, I
believe).

But this will not work correctly on everyones' names, e.g.:

john o'brien John O'brien
john mcdonald John Macdonald
john van de wey John Van De Way

Regards

Jeff Boyce
<Office/Access MVP>
 
D

Douglas J Steele

Hey, Skippy, you're scaring me!

You telling me that StrConv adds an extra "a" to john mcdonald? <g>
 
T

Tony Toews

Douglas J Steele said:
Hey, Skippy, you're scaring me!

You telling me that StrConv adds an extra "a" to john mcdonald? <g>

<chuckle> How about Sir in front with a glass of gin.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
P

Paul Dennis

How would I use StrConv() in a form or table since the syntax expects the
field name. Would you use in on the Text Box 'On Enter' ?
 
G

Graham Mandeno

Hi Paul

You would use it in the AfterUpdate event of the textbox, where you can
change the value after it has been entered, but before the record has
been saved. For example:

Private Sub txtname_Afterupdate()
txtName = StrConv(txtName, vbPropercase)
End Sub

However, be aware of the problem that Jeff pointed out with some names.
One solution is to do the conversion only is the entire string was
entered in lowercase:

If StrComp(txtName, LCase(txtName), vbBinaryCompare) = 0 Then
txtName = StrConv(txtName, vbPropercase)
End If
 
T

Tony Toews

Tony Toews said:
<chuckle> How about Sir in front with a glass of gin.

Inside joke to Canadians. Sir John A McDonald was Canada's first
Prime Minister and well known for liking his booze.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
D

Douglas J Steele

Tony Toews said:
Inside joke to Canadians. Sir John A McDonald was Canada's first
Prime Minister and well known for liking his booze.

Actually, it was Sir John A Macdonald, Tony...<g>

And actually, the confusion about the spelling of his name is fitting, given
what brought triggered this OT thread. I just Googled, and I find his name
gets misspelled as MacDonald. For some odd reason, the hit for Sir John A
Macdonald Junior High School in Calgary shows up in Google as Sir John A
MacDonald, despite the fact that the web site to which it directs you has
his name spelled correctly. Same with the hit to Collections Canada (the
National Library of Canada)
 
F

Fred Boer

The school where I teach is called the W. Ross Macdonald School, named after
William Ross Macdonald, former Lieutenant Governor of Ontario. Even among
our own students the number of variations of spelling that name are amazing!

Cheers
Fred Boer
 
T

Tony Toews

Fred Boer said:
The school where I teach is called the W. Ross Macdonald School, named after
William Ross Macdonald, former Lieutenant Governor of Ontario. Even among
our own students the number of variations of spelling that name are amazing!

And I'd be willing to bet a beer that the teachers would have even
more variations.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

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