Results 1 to 2 of 2
  1. #1
    MykelDL is offline Novice
    Windows 10 Office 365
    Join Date
    May 2017
    Posts
    27

    Seemingly Random Error when Copying/Pasting Query Data into Outlook

    I'm encountering an error that is difficult to recreate. It almost always happens eventually, I just cannot recreate the conditions that cause it to occur so I cannot determine why it occurs.

    What I'm Doing:
    I'm copying data from a query to paste into an Outlook email. The data is SharePoint links (http addresses saved as Long Text to allow for >255 characters) so they can click on the links (which Outlook conveniently converts to the title of the document or folder referred to by just the address) to open the item in SharePoint. e.g., "These documents were approved by X. You can access them directly or open their folders to share with others. Etc. etc."

    How I'm Doing It:
    I have a command button called "Copy for Email" on a record. The record is the approval form data, and links to documents that were approved. My code for this button is (I had to manually type this over, as I cannot share confidential work data--so anything that would invalidate the code are likely typos--the code works, except when it doesn't):

    Code:
    Private Sub cmdExportforEmail()
    
    With DoCmd
    .OpenQuery "qryApprovalsExport", acviewNormal, acEdit .SelectObject acQuery, "qryApprovalsExport" .RunCommand acCmdSelectAllRecords .RunCommand acCmdCopy .Close acQuery, "qryApprovalsExport", acSaveNo
    End With MsgBox "A data table of the SharePoint links for the documents in this approval was copied to your clipboard. It is ready to paste into an email.", vbInformation, "DATA TABLE EXPORT CREATED" End Sub
    What Happens - My Issue
    Doing this pretty much always works the first time. I hit the button, I see the message, I paste into Outlook. All good. Sometimes it will work several times in a row, either with the same approval record, or different ones. At some point, however, I get the following when I try to paste into my Outlook. I get a pop up (like a message box) saying: Word has encountered a problem



    Yes, it says "Word". I presume this is because Word is the underlying editor for html emails in Outlook.

    What I've Done to Try to Figure this Out

    1. If I try to paste into Wordpad (plain text) I just get nothing. The cursor just flashes to acknowledge I pressed some buttons. This to me is an indication there is something wrong with what is residing in the Clipboard. Maybe it's corrupt? Maybe it's blank?
    2. So I used WindowsKey + V to bring up the Clipboard history. When I press the first entry, it typically will paste as unformatted (not in a table) text in both Wordpad and Outlook.
    3. If I open the query manually, copy the data and paste it, it works every time. This isn't quite end-user friendly.


    ***As I was writing this post, I had a thought: I cleared Clipboard data. After doing that, I could not recreate the issue. I toggled off the Clipboard history setting, and could not get the error to recur. So this would potentially point to a Clipboard data corruption--it somehow gets overwhelmed by the data that is being copied. I have never seen this error in other circumstances when copying anything into an email.***

    So maybe I have the source, but I cannot guarantee my users won't also have their Clipboard History off. Has anyone ever encountered this and do you have thoughts on how to potentially avoid this?

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    It would seem that doing something other than copying from a query to the clipboard would be in order (if that's what you're doing). AFAIK, clipboard copy size is limited to available memory, and there is no way you can control that on other people's pc's. Perhaps use OutPutTo on the query (or a report based on the query, as long as that query is not an action query) and send a pdf. Others will probably chime in with other ideas.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 10
    Last Post: 04-04-2022, 05:33 PM
  2. Seemingly random entries are coming up as "#Error"
    By cherold in forum Programming
    Replies: 8
    Last Post: 01-31-2016, 01:51 PM
  3. Trouble copying and pasting
    By tc197 in forum Forms
    Replies: 3
    Last Post: 07-08-2014, 09:02 AM
  4. Error Copying & Pasting from Excel
    By kristyspdx in forum Access
    Replies: 1
    Last Post: 02-03-2012, 08:42 AM
  5. Copying and pasting
    By wthoffman in forum Access
    Replies: 1
    Last Post: 04-14-2010, 04:12 AM

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