Private Sub ReadInboxButton_Click()
' THIS READS YOUR OUTLOOK INBOX
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.Folders
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim EmailContent As Variant
Dim db As Database
Set db = CurrentDb
Dim InboxEmails, a, b As Integer
Dim CheckForError, ReadThisEmail As String
Set myOlApp = New Outlook.Application ' or use ---> CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
myNameSpace.Logon ' this line supposed to prevent Access from jumping to Outlook for authentication
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
InboxEmails = myFolder.Items.Count
UpdateEmployeeTracking = vbNo
For b = 1 To InboxEmails
CurrentEmplCounter.Value = b
Set EmailContent = myFolder.Items.Item(b)
On Error Resume Next
CheckForError = EmailContent.SenderName
If Err.Number = 438 Then
' this error is only for "UPDATE" emails, which cannot be read by Access
Err.Clear
On Error GoTo 0
Exit For ' skip this email
End If
On Error GoTo 0
' -------------------------------------------------------------
ReadThisEmail = MsgBox("Email number " & b & " - " &