clear clipboard

C

Cindy L

In Access 2002, I use DoCmd.RunCommand acCmdSelectRecord
to select the record in my table that I want to
duplicate. I then use acCmdCopy, acCmdPasteAppend to
append the new record to the table.

This works, but when I close the form I get a warning
from MS Access: "You copied a large amount of data onto
the Clipboard. When you copy data onto the Clipboard,
only the reference to the object is copied. If you close
the source document, however, MS Access must past all the
data from its source. Depending on the amount of data,
this can take some time. Do you want to save this data on
the Clipboard?" ... I do not want this message to appear,
but acCmdSetWarnings False doesn't work. VB 6.0's
Clipboard.Clear command is not valid in VBA.

Is there any way to prevent this message from appearing?
Thanks! Cindy
 
K

kent dean

Hi Cindy

Try this..

Docmd.setwarnings False
Then your code
Docmd.setwarnings True

Kind regards

Kent
 
S

Stephen Lebans

Here's a prior post of nime ont his subject. Copy the sample code for
behind a CommandButton control into your Form's Close event.

From: Stephen Lebans ([email protected])
Subject: Re: Clearing Clipboard


View this article only
Newsgroups: microsoft.public.access.formscoding
Date: 2003-04-24 19:57:00 PST



Andy your solution will not work. You have to:
Open the CLipboard
Clear the Clipboard
Close the Clipboard


' Place these API declarations at the top of your Form in the General
Declarations area.
Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long)
As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long



Private Sub cmdClip_Click()
On Error GoTo Err_cmdClip_Click

' Open, Empty and Close Clipboard
' No Clipboard API error handling
Call OpenClipboard(0&)
EmptyClipboard
CloseClipboard
MsgBox "ClipBoard Cleared!"


Exit_cmdClip_Click:
Exit Sub

Err_cmdClip_Click:
MsgBox Err.Description
Resume Exit_cmdClip_Click

End Sub



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
C

Cindy L

I put the acCmdCopy, acCmdPasteAppend between the
SetWarnings but still got the warning message. Then, to
see if I had the SetWarnings True in the wrong place I
eliminated it entirely, and still got the warning message.

Thanks anyway, Kent! Any other ideas?
 
C

Cindy L

Stephen, looks good... but where are the OpenClipboard,
CloseClipboard, EmptyClipboard functions defined? Is
there a standard library somewhere?

Thanks, Cindy
 
C

Cindy L

Further info... I get a Run0-time err '49'; Bad DLL
calling convention on the first call.
Cindy
 
S

Stephen Lebans

My original post states that the API declarations mus tbe placed in the
Form's class module at the top of the Generla Declarations area. THere
is a sample form on my site in the Utilities MDB here:
http://www.lebans.com/utilities.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
C

Cindy L

Your sample works on my machine, so it is definitely a
problem with my original implementation. Thanks very much
for your assistance!
Cindy
 

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