air1access
Technical User
I have a command button on a form - that runs a piece of code...
It connects to a Outlook Inbox, and updates the "Categories" field in the email data.
I almost have it working...! Ha..!
It updates the data/emails in outlook but not the EntryID I'm searching for. It just updates all of the emails in the inbox..
Its not "finding" the EntryId that is in the recordset - rstAccessTable...
Here is what I'm working with... Any suggestions...?
Set rstAccessTable = db.OpenRecordset("SELECT KY_InBox_Wrking_tbl.EntryID, KY_InBox_Wrking_tbl.Categories " & _
"From KY_InBox_Wrking_tbl WHERE (((KY_InBox_Wrking_tbl.EntryID)=getglobal('GBLEntryID')));", dbOpenDynaset)
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.Folders("Escalation.KY.EnBHIXSupport").Folders("Inbox")
Set objItems = objFolder.Items
iNumMessages = objItems.Count
If iNumMessages <> 0 Then
For i = 1 To iNumMessages
If TypeName(objItems(i)) = "MailItem" Then
Set cMail = objItems(i)
rstAccessTable.FindFirst "[EntryID] = '" & cMail.EntryID & "'"
cMail.Categories = rstAccessTable!Categories
cMail.Save
End If
Next i
End If
It connects to a Outlook Inbox, and updates the "Categories" field in the email data.
I almost have it working...! Ha..!
It updates the data/emails in outlook but not the EntryID I'm searching for. It just updates all of the emails in the inbox..
Its not "finding" the EntryId that is in the recordset - rstAccessTable...
Here is what I'm working with... Any suggestions...?
Set rstAccessTable = db.OpenRecordset("SELECT KY_InBox_Wrking_tbl.EntryID, KY_InBox_Wrking_tbl.Categories " & _
"From KY_InBox_Wrking_tbl WHERE (((KY_InBox_Wrking_tbl.EntryID)=getglobal('GBLEntryID')));", dbOpenDynaset)
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objFolder = objnSpace.Folders("Escalation.KY.EnBHIXSupport").Folders("Inbox")
Set objItems = objFolder.Items
iNumMessages = objItems.Count
If iNumMessages <> 0 Then
For i = 1 To iNumMessages
If TypeName(objItems(i)) = "MailItem" Then
Set cMail = objItems(i)
rstAccessTable.FindFirst "[EntryID] = '" & cMail.EntryID & "'"
cMail.Categories = rstAccessTable!Categories
cMail.Save
End If
Next i
End If