Results 1 to 10 of 10
  1. #1
    Join Date
    May 2004
    Posts
    133

    Talking Unanswered: Convert first letter of string to lowercase

    Hiiiiiiiiiiiii
    I have a form with two textboxs : "firstname" and "lastname" that with record source of fields: "firstname" and "lastname" in the "employees" table.
    Sometime somebody input to these field with first lette in uppercase,
    ex: "John Smith" or "Aladin".
    All I want is before data will be updated into table through this form,
    the first letter of string must be converted to lowercase.
    -Can I solve this by using input mask? If can what the mask's format is?
    -Can I solve this by VBA code? I know about Ucase and Lcase. But
    I don't know where to start. For example: which event should I use? etc
    Could you teach me in detail about this?
    many thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    A format mask should do the trick
    you could alos condier using the LCASE function (especially if you want to tidy up your exisitng data)

    incidentally are you certain that all you want to do is convert the first charcter to lower case, or do you actually meant hat you want all of the name in lower case.

  3. #3
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by cuongvt
    Hiiiiiiiiiiiii
    I have a form with two textboxs : "firstname" and "lastname" that with record source of fields: "firstname" and "lastname" in the "employees" table.
    Sometime somebody input to these field with first lette in uppercase,
    ex: "John Smith" or "Aladin".
    All I want is before data will be updated into table through this form,
    the first letter of string must be converted to lowercase.
    -Can I solve this by using input mask? If can what the mask's format is?
    -Can I solve this by VBA code? I know about Ucase and Lcase. But
    I don't know where to start. For example: which event should I use? etc
    Could you teach me in detail about this?
    many thanks
    Hi,

    In the Access help file it has this for input masks:

    >L<?????????????? Maria Pierre

    That is one quick way to do it, but can most likely be done in VBA as well.

    BUD

  4. #4
    Join Date
    May 2004
    Posts
    133
    Thanks. The input mask worked for me.
    By the way, now I want to convert first letter of all string to uppercase.
    Which function should I use?
    thanks

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    as suggested in post number 2, use the LCASE() function.
    You will need to use an update query
    eg update mytable set mycolumn=lcase(mycolumn)

  6. #6
    Join Date
    May 2004
    Posts
    133
    Hi Healdem, thanks for ur reply.
    But I mean, "I want to convert first letter of all string to uppercase", not lower case.
    I already used update statement with ucase, but it converted not only first letter but
    all letters of string into upper case.
    Could you give me some idea?
    Waiting for ur reply.
    thanks

  7. #7
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by cuongvt
    Hi Healdem, thanks for ur reply.
    But I mean, "I want to convert first letter of all string to uppercase", not lower case.
    I already used update statement with ucase, but it converted not only first letter but
    all letters of string into upper case.
    Could you give me some idea?
    Waiting for ur reply.
    thanks
    I think what he is saying healdem is to convert the First letter of EVERY word in a string to uppercase. That be your department, as I haven't a clue myself.

    BUD

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so write a vb function that can be called in your query

    the function prototype would be something like

    split the sentance into words using split() function
    then change the first letter of each word to uppercase
    eg
    strword1=ucase(left$(strword1,1)) & lcase(mid$(strword1,2))

    strword2=ucase(left$(strword2,1)) & lcase(mid$(strword2,2))

    the rebuild the sentance
    newsentance=strword1 & strword2 & strwordn

    you could simplfy the function be making by calling the conversion as a subroutine

    so I'd suggest you have a look at the split, mid$ & left$ functions
    HTH

  9. #9
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  10. #10
    Join Date
    May 2004
    Posts
    133
    Hi healdem. Thanks you very much. And I'm teribbly sorry because I think I said not
    clearly about what I want. last night I saw help file I found it:
    strconv(mystring,3)
    It worked for me.
    Once again, thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •