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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Address Look Up

Status
Not open for further replies.

Kiwiman

Technical User
May 6, 2005
88
GB
Our company has the following email address set up in the Global Address Book - "LastName,FirstName". When you select multiple email recipients, they are separated by semi-colons (;). We use MS Outlook through an exchange server.

A database I have created for the issues surrounding a finance application needs to sent out to a 2 people regularly. They are contained in a table called tblUser, containing 3 fields, UserId,LastName,FirstName.

Everything works fine when I run this command,except that the To field of the email shows:
LastName;FirstName where I expected it to show LastName,FirstName. So MS Outlook thinks it is two people, where in fact it is one??

I have tried a number of permutations to create the email address, but still get the same results. Below is the relevant section of the code.

Code:
'-- Combo of names to assign log to
    stWho = Me.cboEmail
    stWhere = "tblUser.userid = " & stWho & "" 


    '-- Looks up First Name for email from tblUsers
    varFName = DLookup("[FirstName]", "tblUser", stWhere)

'-- Looks up Last Name for email from tblUsers
    varLName = DLookup("[LastName]", "tblUser", stWhere)

    'Assign names to email address
    varTo = varLName & ","
    varTo = varTo & varFName
Any thoughts would be appreciated
 
Hi, Kiwiman,

Are you SURE this is where your code is going astray? Have you set a break point and stepped through the code to see what is actually contained in [blue]varTo[/blue]? Perhaps there should be a space after the comma between [blue]varLName[/blue] and [blue]varFName[/blue]?

Ken S.
 
Hi Eupher

Thanks for your reply. Yes I have put a break through on this code, and when it sends the output to MS Outlook, the varTO variable contains "LastName,FirstName". However the email message has "LastName;FirstName". There does not seem to be anything in the code itself to change the format.

Regards
Les
 
Thanks mp9 - worked a treat. So simple but so easily overlooked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top