Results 1 to 6 of 6
  1. #1
    Join Date
    May 2014
    Posts
    6

    Unanswered: Variable trouble

    Hi all,

    Ive got a field called User_Email. I have a button which is set up that captures the users input from that field and creates an email from the email address they have entered. My code looks like this...


    Dim varName As Variant

    varName = Forms!CallLog!User_Email

    It does work, the input is put into outlook express under the "To" box but it displays it like this....

    email@email.com#email@email.com#

    Is there any reason why its doing this? Obviously all i want is the first part and not the #emailaddress".

    Any help would be much appreciated,

    Matt.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    im guessign you are pulling the email from Outlook, or an email class and the # is used to separate the email address from display as
    ...
    what you could do is SPLIT the controls text
    OR
    use instr to fidn the instance of # and extract the required element.
    you'd need to check which part of Forms!CallLog!User_Email is the actaul email address
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2014
    Posts
    6
    The User_Email is a field on my form. When you say which part is the email address? Surely its just the name of the field?

    I think instr is the best thing to use for this.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I dont know where you are getting the values in the control from. I suspect its an email client program that uses the # symbol as a delimiter. I also suspect that the values are pairs of the actual email address and a display as, but which is which I dunno

    ferintance it could be email#display as# eg matt@domain.tld#matt0705#
    It could just as easily be display as#email# eg matt0705#matt@domain.tld#
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    May 2014
    Posts
    6
    Oh i see! Ive got this much code as is stands. So i believe that varTo will have the split string inside it? If so could you advise me how to select the right part? Also when i select the denomiator as # it wont allow it for some reason?

    Split(var, "#", , ,) - ???

    Dim varName As Variant
    Dim varCC As Variant
    Dim varSubject As Variant
    Dim varBody As Variant
    Dim varTo As Variant

    varName = Forms!CallLog!User_Email

    varTo = Split(varName)

  6. #6
    Join Date
    May 2014
    Posts
    6
    Ive sorted it now! Managed to use the split function then just select the relevant part and append that to the email as required. Thanks for you help healdem!

Posting Permissions

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