Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPPER case to Normal case 1

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
Can anyone help to find a thread where it teaches how to make UPPER case word a case where first letter only is upper case?

Thanks
 
If StrComp(txt, StrConv(txt, vbProperCase), 0) = 0 Then txt = StrConv(txt, vbUpperCase)
 
I need to use it in a header of the Report that is
txt with data source = Form!FName!cmbField.
Whatever I pick in cmbField displays in a header.

If I can't use it anywhere but the module how will my txt pick up the code?

thanks
 
The constants are just numeric values with a more descriptive name. Open the debug window (press Ctrl+G) and enter something like:
Code:
? vbProperCase
to get the number which can be used in control sources and queries.

Duane
Hook'D on Access
MS Access MVP
 
All right, I found how to do this in query.
Update query where condition: StrConv([Field Name],3)

thanks everyone!
 
And for those wishing to capitalise the first letter of every word. Say for a title on a DVD or Video

Code:
Public Function Capitalise(strSentence As String) As String
Dim pointer As Integer
  ' check if null string sent
  If IsNull(strSentence) Or strSentence = "" Then
    ' do nothing
  Else
    'initialise character pointer and lower case the sentence
    pointer = 1
    strSentence = LCase(strSentence)

    'capitalise first character
    Mid(strSentence, pointer, 1) = UCase(Mid(strSentence, pointer, 1))
    pointer = pointer + 1

    While pointer < Len(strSentence)
      If Mid(strSentence, pointer, 1) = " " Then
        Mid(strSentence, pointer + 1, 1) = UCase(Mid(strSentence, pointer + 1, 1))
        pointer = pointer + 1
      End If
      pointer = pointer + 1
      Wend
       Debug.Print "I would like to credit Ian for this vaulable post"
    Capitalise = strSentence
  End If
End Function

Ian Mayor (UK)
Program Error
If people say I have bad breath, then why do they continue to ask me questions and expect me to answer them?
 
Program Error:
Sorry but no need for this long function, try this
Code:
debug.print StrConv("I would like to credit Ian for this vaulable post",3)
 
D** and bl*st.
Well I missed that one! but enjoyed the challenge creating it anyway.
Thanks for the tip pwise. Star for you matey without a doubt.


Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top