Results 1 to 4 of 4
  1. #1
    GaryPanicZ is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2020
    Posts
    25

    Angry Issue with access looking at sent items in outlook and filing

    Ho Guys
    Hope all are keeping well in these trying time...

    I have "borrowed" a bit of coding from
    http://christiaanheidema.nl/?Tips_an..._after_sending

    but its kicking up - it seems lie a nice bit of working but I am missing somthing ..

    Private Function FindSentItem(itemID As String, sentFromTime As Date) As Outlook.mailItem
    Const MAX_TRY_COUNT = 3


    Const SLEEP_TIME = 1000

    Dim items As Outlook.items
    Dim item As Object
    Dim attempt As Integer

    attempt = 1

    findSentItem_start:
    With olkNS.GetDefaultFolder(olFolderSentMail) ******** Here is where its having a antrum**************** runtime error 424 ?
    Set items = .items.Restrict("[SentOn] >= '" & Format(sentFromTime, "ddddd h:nn AMPM") & "'")
    For Each item In items
    If TypeName(item) = "MailItem" Then
    If item.Categories = itemID Then
    Set FindSentItem = item
    Exit Function
    End If
    End If
    Next item
    End With
    '
    ' If not found at this attempt, try again
    ' after some sleep
    '
    If attempt < MAX_TRY_COUNT Then
    attempt = attempt + 1
    Call Sleep(SLEEP_TIME)
    GoTo findSentItem_start
    End If
    Set FindSentItem = Nothing

    End Function



    -
    Attached Files Attached Files

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    What error message are you receiving?
    You might research some of the links at the bottom of the page in Similar Threads.

  3. #3
    GaryPanicZ is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2020
    Posts
    25
    runtime error 424
    Object required

    With olkNS.GetDefaultFolder(olFolderSentMail)

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I have not used Outlook for several years, so have no way to test/experiment.

    Do you have olkNS dimmed anywhere?

    I have formatted your code and placed it within Code tags for readability.

    Code:
    Private Function FindSentItem(itemID As String, sentFromTime As Date) As Outlook.mailItem
        Const MAX_TRY_COUNT = 3
        Const SLEEP_TIME = 1000
    
        Dim items As Outlook.items
        Dim item As Object
        Dim attempt As Integer
    
        attempt = 1
    
    findSentItem_start:
        With olkNS.GetDefaultFolder(olFolderSentMail) '******** Here is where its having a antrum**************** runtime error 424 ?
            Set items = .items.Restrict("[SentOn] >= '" & Format(sentFromTime, "ddddd h:nn AMPM") & "'")
            For Each item In items
                If TypeName(item) = "MailItem" Then
                    If item.Categories = itemID Then
                        Set FindSentItem = item
                        Exit Function
                    End If
                End If
            Next item
        End With
        '
        ' If not found at this attempt, try again
        ' after some sleep
        '
        If attempt < MAX_TRY_COUNT Then
            attempt = attempt + 1
            Call Sleep(SLEEP_TIME)
            GoTo findSentItem_start
        End If
        Set FindSentItem = Nothing
    
    End Function

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Adding outlook folder items to listbox
    By DMT Dave in forum Access
    Replies: 16
    Last Post: 08-20-2020, 02:26 AM
  2. Outlook Security Warning issue with DoCmd.SendObject
    By aellistechsupport in forum Modules
    Replies: 7
    Last Post: 09-22-2015, 12:04 PM
  3. Replies: 5
    Last Post: 02-28-2015, 06:50 PM
  4. Replies: 0
    Last Post: 12-15-2014, 08:18 AM
  5. issue with linking outlook folder to access
    By live2ride in forum Import/Export Data
    Replies: 7
    Last Post: 12-20-2012, 12:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums