Results 1 to 4 of 4
  1. #1
    Ganymede is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Dec 2011
    Posts
    116

    After Insert Not Working from Link to Outlook Folder

    Current state: My database contains a link to an outlook folder. The name of the link (as it appears in my list of tables) is "PRRB Log Entries." I also have an append query titled "FromPRRBAppendQ" that extracts data from that link and appends it to a table called "Docketing."

    Desired outcome: When I receive a new email in the folder attached to "PRRB Log Entries," I want "FromPRRBAppendQ" to automatically run and update the "Docketing" table.

    Attempted solution:

    Step 1: I created a public function called "EmailUpdate()" that will run "FromPRRBAppendQ."



    Code:
    Public Function EmailUpdate()
    CurrentDb.Execute ("FromPRRBAppendQ")
    End Function
    Step 2: I created a "RunCode" Macro called "EmailUpdate." It basically calls the "EmailUpdate()" function. I have confirmed that the macro works when I run it manually. So everything works fine up to step 2.

    Step 3: In the design view of the link to "PRRB Log Entries", I went to "Create Data Macro" -> "After Insert" -> "RunDataMacro" -> Macro Name: EmailUpdate

    Step 3 is where things break down. When I receive a new email in the outlook folder tied to "PRRB Log Entries", the macro does not run.

    Can anyone tell me what I'm missing here? I would very much appreciate any feedback.

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Access has no knowledge of when an email arrives. You would have to repeatedly poll Outlook from Access to see if there are any new items that fit the bill, and that would not be efficient. My approach (if this was my Outlook session and not yours) would be to have code in Outlook that runs the Access code IF the db is loaded (and maybe a particular form). I don't know if you can have this work for multiple Outlook users. It may be easier to poll Outlook from Access by manually running your macro/code. Sorry I don't know how to make all that work, but if I was to attempt it, I'd start with a google search like "poll Outlook from Access" or "check for new mail in an Outlook folder from Access".
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Ganymede is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Dec 2011
    Posts
    116
    Quote Originally Posted by Micron View Post
    Access has no knowledge of when an email arrives. You would have to repeatedly poll Outlook from Access to see if there are any new items that fit the bill, and that would not be efficient. My approach (if this was my Outlook session and not yours) would be to have code in Outlook that runs the Access code IF the db is loaded (and maybe a particular form). I don't know if you can have this work for multiple Outlook users. It may be easier to poll Outlook from Access by manually running your macro/code. Sorry I don't know how to make all that work, but if I was to attempt it, I'd start with a google search like "poll Outlook from Access" or "check for new mail in an Outlook folder from Access".
    Thank you for your response. I suppose I was assuming that access regards the link to my outlook folder as a table. Since every new email that comes to the folder adds a record to the link, I figured that would be a good trigger. But from your response I take it that when a linked table/outlook folder adds a record, Access doesn't read it the same way as when a record is added to an actual table within the databse. So an afterinsert event isn't going to trigger when an outlook folder gets a new record. (Is that true for all linked tables or just tables linked from outlook? Becuase I have a few afterinsert events that are linked to tables from another database.) Is there any other way for access to monitor when the number of records in a linked folder has increased? I suppose I'll research that next.

  4. #4
    Minty is offline VIP
    Windows 11 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    You could do a timer event on a form to check how many records are in the table compared to the last time you checked.
    If it's more then fire your event.

    Not sure how you would handle multiple emails arriving, or whether that even matters?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Working query stops working after importing
    By Abacus1234 in forum Import/Export Data
    Replies: 3
    Last Post: 10-25-2015, 09:12 PM
  2. Replies: 3
    Last Post: 05-27-2015, 01:04 PM
  3. SubForm will not update after an insert
    By kowalski in forum Forms
    Replies: 11
    Last Post: 08-16-2013, 06:49 PM
  4. After Insert macro not functioning
    By scottnew2ac in forum Access
    Replies: 2
    Last Post: 07-26-2012, 09:25 AM
  5. Attachment data type INSERT INTO not working
    By LouisLouis in forum Programming
    Replies: 0
    Last Post: 09-27-2009, 02:23 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