Question

Every once and awhile a user will complain about my Access application losing fields. I've found out that they are right. Access in certain situations will simply drop accepting data from a copy and paste operation for a certain field, consistently.

It is almost as if Access thinks that the pasted data is only numeric data, then onces it sees Alpha it attempts to cast to a number, fails then ignores it.

The image below is not the custom application but a new Access file, where I just copy and paste the Excel data raw. I've looked at the raw clipboard data using http://www.peterbuettner.de/develop/tools/clipview/ but I do not see any obvious issues or format issues.

Thoughts?

Test Application and Data

Was it helpful?

Solution

Do a 'paste special' operation and paste as plain text. For ease of use, I recommend pinning the 'paste special' button to the Quick Access toolbar.

Sometimes Access gets confused when you let it guess what you're pasting. Pasting as plain text is the best way to force it to work.

Edit

Example Code for Right Click Menu

Public Function CreateGeneralClipBoardMenu()
    On Error Resume Next
    CommandBars("GeneralClipboardMenu").Delete

    Dim cmb As Office.CommandBar

    Set cmb = CommandBars.Add("GeneralClipboardMenu", msoBarPopup, False, False)

        With cmb
            .Controls.Add msoControlButton, 21, , , True  ' Cut
            .Controls.Add msoControlButton, 19, , , True  ' Copy
            .Controls.Add msoControlButton, 755, , , True  ' Paste Special
        End With

    Set cmb = Nothing
End Function

The ID# 755 is a magic number for Paste Special, and I found it on this list: http://support.microsoft.com/kb/213552

Where to set it in Access 2013. Access Options - Current Database - Shortcut Ribbon Bar

Access Options - Current Database - Shortcut Ribbon Bar

OTHER TIPS

As far as I can tell this a recognized glitch. If true, then all you can do is work around it, which unfortunately affects your end-users instead of just yourself.

Found a similar description at accessforums.net/access/copy-paste-csv-access-2010-a-20031.html.

Hmmm. So what happens if the data from Excel is sorted such that one of the alpha-numeric entries is on the top row?

you have to put a header[string so that access will consider all the following data as string] before copying the data. insert new column above your header then copy/paste your data including the header and empty column to your access table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top