Format field

dr223

Registered User.
Local time
Yesterday, 19:56
Joined
Nov 15, 2007
Messages
219
Hi,

I have this code which makes all the data displayed on the form in this respective field capital letters e.g John will be displayed as JOHN and saved as so.

However, what i want to do is only make the first letter as John not JOHN. How can I change the code?

Me.surname_forename = UCase(Me.surname_forename)

Thanks
 
Me.surname_forename = StrConv("JOHN", vbProperCase) = John
Me.surname_forename = StrConv("john", vbProperCase) = John

The issue you may run into (and this has been discussed and solutions provided already) is when you get unique name conjunctions.

StrConv("oscar de la hoya", vbProperCase) = Oscar De La Hoya (should be Oscar de la Hoya)
StrConv("dick van patten", vbProperCase) = Dick Van Patten (should be Dick van Patten)
StrConv("thurston howell, iii", vbProperCase) = Thurston Howell, Iii (should be Thurston Howell, III)

How you handle those situations is up to you. Since they are the exception rather than the rule, you may just want to ignore them. If not, search the forums for StrConv vbProperCase and you should come across several proposed solutions on handling this. I think I even wrote one of them.
 
Hi,

why dont you make it simple by using the built in "mask" in the table? you could i think, choose something like >L?????????? which makes the first letter a capital. this should the show the format as needed. as for the other samples provided by Moniker, i have a code that would split a name " Dick van Dyke " into 3 variables, format as you need and place them back together as 1. you there would be a bit of wrk to get the needed effect but it works well with Excel so im guessing the basis is the same.

NS
 
Hi,

The code below will convert john to John. However, I want any name entered to be converted not only john. How can I do that?

Me.surname_forename = StrConv("john", vbProperCase) = John


Thanks
 
Me.surname_forename = StrConv(Me.surname_forename, vbProperCase)
 

Users who are viewing this thread

Back
Top Bottom