How to clear the clipboard from Access 97

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?
 
D

Dirk Goldgar

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
 
G

Guest

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.
 
D

david epsom dot com dot au

For what is worth, I found that changing from Win98/Office97 to
Win2K/Office 2000 also fixed a clipboard problem like this...

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top