Results 1 to 3 of 3

Thread: Variable Questions

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    IL
    Posts
    39

    Post

    x = "hello, how are you?"

    I want the first character in x to be capital each time. So that it makes -

    x = "Hello, how are you?"

    How do I do that? Supose I want to put a "." at the end of every variable, how do I do that? Thanks

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284

    Post

    Dim hold As String
    'to change the first letter to a capital
    'using the form caption as an example
    hold = Left(Me.Caption, 1)
    hold = UCase(hold)
    Me.Caption = hold & Right(Me.Caption, Len(Me.Caption) - 1)
    'to put a full stop at the end
    Me.Caption = Me.Caption & "."


  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Bigley's answer works just fine, but it's easier than that.

    Me.Caption = UCase(Left(Me.Caption, 1)) & Right(Me.Caption, Len(Me.Caption) - 1) & "."


    (or substitute x for Me.Caption)

    ------------------
    Marty
    What did the fish say when it hit the concrete wall?
    > > > > > "Dam!"

Posting Permissions

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



Click Here to Expand Forum to Full Width