From msAccess find correct email account in outlook

Access 2010 vba
outlook

What Am I trying to do:
Trying to perform a search in the correct    "Inbox"

First. : When i open my outlook  I have several Profiles under my Primary profile

>fordraiders@zzzz.com
  Inbox

>bluebook
  Inbox
>redbook
  Inbox


I tried to access the profile directly but it still only searches in the main "InbOx"    (fordraiders@zzzz.com)



Before I perform a search I need to make sure I'm looking in the correct profile ?
before i execute any code..

I'm trying to loop through each profile but this is not working ?

' LOOK FOR OUTLOOK OPEN
Dim objOL As Outlook.Application
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.Namespace
Dim myInbox As Outlook.MAPIFolder
Dim myitems As Outlook.Items
Dim myitem As Object
Dim objInsp As Outlook.Inspector
Dim oAccount As Outlook.Account

For Each oAccount In myOlApp.Session.Accounts
  If oAccount = "redbook" Then
      ' code here
  end if
next
 


Thanks
fordraiders
LVL 3
FordraidersAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

John TsioumprisSoftware & Systems EngineerCommented:
Add a watch at
myOlApp.Session.Accounts

Open in new window

and check from the watch window what properties and methods are available...maybe it needs a different approach...
0
FordraidersAuthor Commented:
John,
I did , it will not loop

fordraiders
0
FordraidersAuthor Commented:
it finds my main fordraiders@zzz.com

but will not find the others.

dp
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

John TsioumprisSoftware & Systems EngineerCommented:
There seems to be a Stores collection that "contains" the Outlook Accounts
Take a look here
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
FordraidersAuthor Commented:
That was it ...even my admin for outllok kept calling them profiles. I knew their had to be a specific profile name under current session "Stores"...Phew..

That worked.. had to change a set statement but it listed the stores(profiles).

Dim colStores As Outlook.Stores
Dim oStore As Outlook.Store
Dim oRoot As Outlook.folder
 
 Set colStores = Outlook.Application.Session.Stores
 
 For Each oStore In colStores
 
 Set oRoot = oStore.GetRootFolder
 
 Debug.Print (oRoot.FolderPath)

 Next

Thanks !
fordraiders
0
John TsioumprisSoftware & Systems EngineerCommented:
Glad it worked out like you wanted
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.