Outlook search from Access

L

llamadave

Sending email from Access is working great for me. Now I want to click on an
email address in an Access 2007 form, then go automatically to Outlook with
the search box filled in with the email address and search "All Mail Items".

David
 
D

David C. Holley

Its not possible to put the email address in the search box, however it is
entirely do a search using code. The Outlook group will guide you in your
quest grasshopper.
 
L

llamadave

You can do it, but it took me a while to figure it out. This works great:

Private Sub Command540_Click()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim EmailTxt As String
EmailTxt = Me!Email1 & " OR " & Me!Email2
Set myOlExp = myOlApp.ActiveExplorer
myOlExp.Search EmailTxt, 1
myOlExp.Display
End Sub
 
S

Stuart McCall

llamadave said:
You can do it, but it took me a while to figure it out. This works great:

Private Sub Command540_Click()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim EmailTxt As String
EmailTxt = Me!Email1 & " OR " & Me!Email2
Set myOlExp = myOlApp.ActiveExplorer
myOlExp.Search EmailTxt, 1
myOlExp.Display
End Sub

You would be well advised to include:

Set myOlExp = Nothing
Set myOlApp = Nothing

just before the End Sub

VBA is supposed to do this automatically when they go out of scope, but it's
not always reliable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top