views:

2625

answers:

6

While debugging queries written in MS Access 2007 (problem was the same in all previous versions too), I'll run the query and then copy the results into Excel. Depending on results, I switch batch to Access to refine the results and go back into design mode of the query. At this point, I get an annoying warning: you copied a large amount of data onto the clipboard. ...Do you want to save this data on the clipboard? I have never wanted to do this.

The MS Office clipboard is disabled so this function is happening with the standard Windows clipboard. Is there a way to disable the warning and assume No as the default?

+1  A: 

I think you may have to disable the MS clipboard. Try this:

  1. Quit any programs that are running.
  2. Click Start, and then click Run. Type regedit and click OK.
  3. In the Registry Editor, click to select the following subkey (folder): HKey_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General
  4. On the Edit menu, point to New and click DWORD Value. With New Value #1 selected, type AcbControl, and then press ENTER.
  5. On the Edit menu, click Modify. In the Edit DWORD Value dialog box, click Decimal under Base. Type 1 in the Value data box. Click OK and quit the Registry Editor.

NOTE: You cannot disable (or enable) the Office Clipboard for only a single Office program by modifying the registry.

Here's the MS KB article

OTisler
Thanks for the info. The office clipboard is already disabled, since it's very rare for me to be copying multiple things arounds. I'll edit the question to make that clear.
Knox
+1  A: 

In my experience, you only get this message when you close an application. Are you closing Excel before returning to Access? If so, don't close it and see if you no longer get the message.

EDIT after trying instructions for producing the error:

The only way to avoid the error message is to turn off notifications before entering design view, as in:

  DoCmd.SetWarnings False

And you'd want to turn it back on after you are done with your editing.

But there's no place to run this code, since you're just using the Access UI to edit a query.

I don't quite understand why this warning is considered a problem. Maybe you're pasting, going back to design view, changing criteria, running again, pasting again? If so, turning SetWarnings off might do the trick.

If you wanted it to happen automatically, you could conceivably use the Screen.ActiveDatasheet object to do this. What you'd want to do is write a function:

  Public Function ChangeWarnings(bolSetting As Boolean) As Boolean
    DoCmd.Setwarnings bolSetting
  End Function

...then when you open your query in datasheet view, in the Immediate window, type these two lines:

  Screen.ActiveDatasheet.OnActivate = "=ChangeWarnings(False)"
  Screen.ActiveDatasheet.OnDeactivate = "=ChangeWarnings(True)"

You could also certainly write code that sets this up for you.

One note -- it doesn't "stick" for the Screen.ActiveDatasheet object when opening or closing a different one. It applies only to the Datasheet that is active when you assign the event actions.

David-W-Fenton
Hi, David - I certainly respect your input - but no, I'm not closing Excel. Open Access, run query, copy results, open excel, paste results, select Access and select design view, get warning.
Knox
+1  A: 

You could set the OnClose event of the form up to clear the clipboard.

Put the below code into a module in your database.

Private Declare Function apiOpenClipboard Lib "User32" Alias
"OpenClipboard" (ByVal hWnd As Long) As Long

Private Declare Function apiEmptyClipboard Lib "User32" Alias
"EmptyClipboard" () As Long

Private Declare Function apiCloseClipboard Lib "User32" Alias
"CloseClipboard" () As Long

Function EmptyClipboard()
  If apiOpenClipboard(0&) <> 0 Then
    Call apiEmptyClipboard
    Call apiCloseClipboard
  End If
End Function

Then in the Close event of your form use:

EmptyClipboard
KevenDenen
Thank you for the suggestion, but I'm running a query directly; there's no form to attach any events to. But maybe I could have a form that clears the clipboard whenever Access gets the focus. hmmmm.
Knox
A: 

this helped me a great deal, thanks. Alan

A: 

For Excel: Fexcel = New Microsoft.Office.Interop.Excel.Application Fexcel.DisplayAlerts = False

Do same for Access

josh
The message is coming from Access, so this would have no effect.
David-W-Fenton
David - you obviously haven't tried it.
josh
A: 

Argh I'm having the exact same issue. It leaves a dangling Access process out on the server that I can't kill because it was started with the scheduler and not by me directly.

This then messes up my next run the next day. Any solutions to this that don't require messing with the registry?

SetWarnings No as the first line in the macro does NOT work.

I'm running office 2007 on a windows 2008 server.

Jaman Swearingen
Um, why are you running Access on a server?
David-W-Fenton