How to clear the clipboard from Access 97

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a problem with Access hanging when the user copy/pastes large
query results. They are able to successfully copy/paste but when the return
to Access and try to close the query Access appears to hang. I found that if
I manually clear the clipboard and then close the query it seesm to work.
Can someone tell me how I can clear the clipboard via Access code?
 
Mo said:
I am having a problem with Access hanging when the user copy/pastes
large query results. They are able to successfully copy/paste but
when the return to Access and try to close the query Access appears
to hang. I found that if I manually clear the clipboard and then
close the query it seesm to work. Can someone tell me how I can clear
the clipboard via Access code?

Paste the following into a standard module:

'----- start of module code -----
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

'----- end of module code -----

Now you can empty the clipboard from code by writing

EmptyClipboard
 
This worked great, thanks Dirk!

I've added a button so the user's can clear the clipboard before they close
down the query results. Works like a charm.
 
For what is worth, I found that changing from Win98/Office97 to
Win2K/Office 2000 also fixed a clipboard problem like this...

(david)
 
Back
Top