Uppercase by position in field

E

eighthman11

Is there a way to uppercase a letter by position. For example I want
to upper case any character that follows a period "." in a field.
Thanks for any help.
 
P

Phillip Windell

What happens when it takes the sentence,
"John S. went down the street",
and turns it into,
"John S. Went down the street"?

Phil
 
G

Graham Mandeno

Use the AfterUpdate event of the textbox control on your form. There you
can perform any kind of "cleanup" operations on the data and change it in
whatever way you like.

For example, the following code will uppercase any character preceded by a
".":

Dim iPos As Integer
iPos = 1
Do
iPos = InStr(iPos, MyTextbox, ".")
If iPos = 0 Or iPos = Len(MyTextbox) Then Exit Do
iPos = iPos + 1
Mid(MyTextbox, iPos, 1) = UCase(Mid(MyTextbox, iPos, 1))
Loop
 
E

eighthman11

Hey Graham thanks for taking the time to help. I'm putting in the code
now to give it a try. You're a life saver.



Graham said:
Use the AfterUpdate event of the textbox control on your form. There you
can perform any kind of "cleanup" operations on the data and change it in
whatever way you like.

For example, the following code will uppercase any character preceded by a
".":

Dim iPos As Integer
iPos = 1
Do
iPos = InStr(iPos, MyTextbox, ".")
If iPos = 0 Or iPos = Len(MyTextbox) Then Exit Do
iPos = iPos + 1
Mid(MyTextbox, iPos, 1) = UCase(Mid(MyTextbox, iPos, 1))
Loop

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

eighthman11 said:
Is there a way to uppercase a letter by position. For example I want
to upper case any character that follows a period "." in a field.
Thanks for any help.
 

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