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

Deleting Characters Left of "(" 1

Status
Not open for further replies.

outsourceoncall

Technical User
Dec 20, 2001
36
US
Deleting Left of "(" +1

I have linked my Outlook Contacts and and my Outlook Sent Items in Access. I now want to associate the Contacts to the Sent Items. The only way I can see is to relate the email address. But the sent items Stores the email address in the [TO] field like this:

Elvis Presley (EPresley@aolsucks.com)

and the Contact Stores it like this email like this:

EPresley@aolsucks.com

I am no coder...what is the code to delete everything left of the first character past "(" ?

" I can do a find and replace for the last ")".

Thanks!
 
If you want to do this in a query, you could try this:

=IIF(InStr([TO],"(")=0,[TO],Mid(Left([TO],Len([TO])-1),InStr([TO],"(")+1))

This first checks for the presence of a left-parenthesis in the [TO] field. If none is found (the result is 0) then the entire [TO] field is used. Otherwise, the [TO] field is reduced by 1 byte on the right (assuming the right parenthesis is the last byte) and the characters from one byte to the right of the left parenthesis to the end of that field are extracted. This should give you just the email address.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top