How do you get Access to auto format the capitalisation of the first letter of a word ie) in an address field in a form and can you get it to format say an incorrectly capitalised input mid word back to lower case
Check Ms Access help. Under "case", ther are several topics regarding correction of case (capitalization) errors on data entry. I am not aware of any function like "Proper" in Ms Access, however the function is trivial to generate - it is just difficult to use properly (no pun intended), since you need to "know" what to NOT capitalize in many cases.
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
Have you tried using an input mask in the address fields? Check Help--I think there are some examples of what you are looking for-- [sig]<p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br> [/sig]
Thanks for your reply. I have never run across this function - but have "coded" the Proper function a few times. Now I won't have to do it again - at least in Ms Access.
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
I think we have wandered a bit from your inquiry. Your original post refered to "forcing" the input on a form to follow your rules. In my opinion, the proper response to this is what I posted (much) earlier. The various "Case" constraints may be applied to the control (text box) where the data is input by the user. If you want to use the StrConv function refered to by Lightning, it would probably be used in the validate or after update functions of the individual control (text box) [sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
I have lookied in the help files re StrConv as suggested. Unlive Access97 where there seemed to be a good explination and also examples of how to utilise the topic, Access 2000 that I have upgraded to seems to have a backward step in relation to help and basically tells you nothing. To be honest i am regretting moving to 2000 on a lot of functions but the rest of my collegues upgraded to I was in the minority (a bit like Tony Blair at the moment!) Could you therefore explain what this StrConv is and where and how I should utilise it.
Try this in your queries or text box. It uppercases each word in the string
Song Lyricist: (StrConv([Lyricist],3))
I have a music data base and the original entries were all upper case so by using the StrConv i was able to show the information with only the first letter in upper case. This also works on information that is all lower case as well.
the following examples are all done in the immediate window w/ Ms Access 97:
Mystr = "michael l red"
? StrConv(MyStr, vbProperCase)
Michael L Red
mystr = "michael l red jr"
? strconv(mystr, vbProperCase)
Michael L Red Jr
MyStr = "michael l red iii"
? strconv(Mystr, vbProperCase)
Michael L Red Iii
As you can see from the lase example, there can be some problems in using this approach. David D's example appears to be taken from a query (syntax), however the equivalent would work for a form control (text box) placed in the correct event.
You need to be a little careful. Placing it "bare" in an after update event will cause an endless loop, because each after update will cause an update, which will call the after update .... soon to run out of memory ...., so you would first need to check wheather the entry was already proper.
Also, the norm /default for Ms Access is "option compare database", which defeats a direct comparision based on case sensitivity (AAAA = aaaa)? so your inital test needs to use an additional function - StrComp - Below is a sample which "works" in the after update event, with the problems noted above (e.g. changing iii to Iii) unresolved. Note that the list of exceptions in putting proper names in "Proper" format appears to be essientially infinite. In one previous lifetime, I maintained a modest database of ~~ 1000 records w/ "Proper names" in two or three fields. I did a "roll my own version of the strconv - proper, which worked very much like it - the exceptions counted out to almost 100 seperate instances where "Proper" did not return the "correct" capitalization.
Private Sub txtPublisher_AfterUpdate()
If (StrComp(txtPublisher, StrConv(txtPublisher, vbProperCase), 0)) Then
txtPublisher = StrConv(txtPublisher, vbProperCase)
End If
End Sub
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.