Outlook 2007 Criteria Search

Status
Not open for further replies.

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
The following code searches the field with the certain name in the field. Can I add to this macro how it searches that field and another field that has nothing it that other field?

Sub SearchByTopFollowUpNextStepTalk()
Dim myOlApp As New outlook.Application
txtSearch = "[TopFollowUpNextStepTalk]:(Top)"
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Any update please. And so you know, these fields were created for the contact form and I would like to search more than one field so if the first field has a word in it, and the next field as not words in it, it will show the contacts that those fields are set up for those contacts. So another field name is TopFollowUpNextStepTalkMeet.

And again, here is the macro to upgrade if that is possible which I need right away.

Sub SearchByTopFollowUpNextStepTalk()
Dim myOlApp As New outlook.Application
txtSearch = "[TopFollowUpNextStepTalk]:(Top)"
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub
[DOUBLEPOST=1445095513][/DOUBLEPOST]And when I post the macro before the last word Top, is shows that picture...which is not the code....before the last word Top is the : (
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
No. I want to find contacts if the contact has the value in field1 and field 2.
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
So what do we add to the macro so it also searches the other field and the same time?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Put the two strings together with an AND -
txtSearch = "[TopFollowUpNextStepTalk]: (Top) AND [Field2] : (Whatever)"
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
And as to field 2, I stiil want to see the contact if the field2 is no words. So as to field 2, do i show in the macro as just ( ). ??
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Try it - not sure it will work though. Do all contacts have that field?
 

LMS

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Yes. All contacts have all my fields as the fields are in the contact form
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
If they all have it, try using ("") for the search. If you are looking for a value or blank use ("value1" OR "").
 
Status
Not open for further replies.
Top