Access Email

I'm using the following coded to generated Outlook emails from Access. The output is in the format :
Emily.Rosenb@abc.gov#mailto:Emily.Rosenb@abc
How would I remove the #mailto:Emily.Rosenb@abc?





On Error GoTo err
    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Dim strBody As String
    Dim db As Database
    Dim rs As Recordset
    Dim emailcount As Long
    
    emailcount = 0
    
    Set OutApp = CreateObject("Outlook.Application")
    Set db = CurrentDb

    Select Case Me.EMAILTYPE
        Case "Annual Training"
            Set rs = Forms!frmAnnualTraining.Form.RecordsetClone
    End Select

    If rs.RecordCount = 0 Then
        MsgBox "There are no reminders to create!", vbCritical, "Reminders"
        Set rs = Nothing
        Exit Sub
    End If
            
    rs.MoveFirst
    Do Until rs.EOF
        If Not IsNull(rs![EMPEMAIL]) And IsNull(rs![AETDATE]) Then
            Set OutMail = OutApp.CreateItem(0)
            With OutMail
                .To = rs![EMPEMAIL]
                .CC = ""
                .BCC = ""
                .Subject = Me.EMAILSUBJECT
                .HTMLBody = Me.EMAILDESC
                .Save
                emailcount = emailcount + 1
            End With
        End If
        rs.MoveNext
    Loop

If emailcount = 0 Then MsgBox "There are no employees without an Annual Training date for the calendar year." Else MsgBox "Created Alerts.  Please review them and send."
DoCmd.Close acForm, "frmReminders"
Exit Sub

err:
MsgBox "Unable to create emails at this time.  If problem persists, contact system administrator."
MsgBox err.Description
Exit Sub
End Sub

Open in new window

shieldscoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Try using Recipients.Add instead of directly setting the To method:

With OutMail
  .To = .Recipients.Add(rs("EMPEMAIL")
  etc

See this link: https://docs.microsoft.com/en-us/office/vba/api/outlook.recipients.add

If that doesn't work, you can do this:

.To = Split(rs![EMPEMAIL], "#")(0)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shieldscoAuthor Commented:
Thanks .... I found a solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.