Looking For VBA Code

G

GrandMaMa

I understand that there is an instruction that will convert all upper case
words to the appropriate capitalization.

I am looking for the code that will convert the school names in our district
from:

The Name of the School is in a Field in a Table.

XAVIER CANUTILLO HIGH SCHOOL to Xavier Canutillo High School.

Does anyone know what that instruction is?

Thanks in Advance

Granny
 
D

Dirk Goldgar

In
GrandMaMa said:
I understand that there is an instruction that will convert all upper
case words to the appropriate capitalization.

I am looking for the code that will convert the school names in our
district from:

The Name of the School is in a Field in a Table.

XAVIER CANUTILLO HIGH SCHOOL to Xavier Canutillo High School.

Does anyone know what that instruction is?

Thanks in Advance

Granny

There is nothing that will always get it right. The function you are
looking for is the VBA function StrConv, called with the argument
vbProperCase, which has the numeric value of 3. For example, an update
query might have SQL like this:

UPDATE Schools SET SchoolName = StrConv(SchoolName, 3);

That will capitalize the first letter of every space-delimited word in
the field, and make all the other letters lower case.

However, you should realize that there are words and names that have
unusual capitalizations, and the function will not necessarily give you
the correct captialization for those. After running an update like the
above, you usually need to inspect the results and fix those cases where
the function got it wrong.
 
S

Steve

You need to use an update query. Create a query based on your table and only
include SchoolName in the query. Click on the Query Type button in the menu
at the top of the screen and change the query to an Update query. Under
SchoolName where itsays update to, type in:
StrConv([SchoolName],3)
When you run your query you will get the resukts you want.

Note: Use the actual field name in your tavle for SchoolName.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 

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