Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Brandon, Manitoba, Canada
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Format a variable (A2KSR1)

    Is it possible to format a variable that has been inserted into a string statement. eg.
    Strmessage = "'" & NewData & "' will have to be added to our database. Proceed?"
    NewData will be a phone number without the hyphen but I would like it to show in this statement with the hyphen.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Format a variable (A2KSR1)

    Strmessage = "'" & Format(NewData,"@@@-@@@@") & "' will have to be added to our database. Proceed?"
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Brandon, Manitoba, Canada
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format a variable (A2KSR1)

    What?! I tried Strmessage = "'" & Format(NewData,"000-0000") & "' will have to be added to our database. Proceed?" prior to posting but it didn't work! I must have screwed up on the syntax. Thanks Charlotte.

  4. #4
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format a variable (A2KSR1)

    Check out the example file that I posted to your question about the combo boxes. It has a combo box with the format() function in it.

    J

  5. #5
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Format a variable (A2KSR1)

    It is probably your use of '0's in your format function.

    If your phone numbers are all the same length, ie 3 digits then hyphen then 4 digits then use the '@' symbol. If you have some phone numbers with area codes and some without (ie. some 04387-3333 and some 387-3333) then you will want to use the '&' symbol in your format function.

    J

Posting Permissions

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