Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clipboard message... removeable? 2

Status
Not open for further replies.

Turb

Technical User
Feb 11, 2003
154
US
Hi all!
I have a command button, in the header of a form, in an Access 2003 database that performs copy/paste operations for me; It does this very well.
My only issue is that when I close the form after doing a copy/paste operation, I always get a "Microsoft Office Access" message: "You copied a large amount of data onto the clipboard... Do you want to save this data on the Clipboard?"
I've tried using "DoCmd.SetWarnings False" as an 'On Open' event to stop this, but it doesn't stop the message.
I guess it's not a "warning" message per se.

Can someone help?

Thanks!


- Turb
 
Try issuing
Code:
Clipboard.Clear
after your Paste.
 
Hi Golom!
Thank you for your response.
I tried your suggestion and placed Clipboard.Clear in my code here:
Code:
Private Sub COPY_REC_Click()
On Error GoTo Err_COPY_REC_Click

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdPasteAppend
    Clipboard.Clear
    Me.SERIALNO = " "
    DoCmd.GoToRecord , , acLast
    DoCmd.GoToControl "SERIALNO"
    
Exit_COPY_REC_Click:
    Exit Sub

Err_COPY_REC_Click:
    MsgBox err.Description
    Resume Exit_COPY_REC_Click
    
End Sub

and here:

Code:
Private Sub COPY_REC_Click()
On Error GoTo Err_COPY_REC_Click

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdPasteAppend
    Me.SERIALNO = " "
    DoCmd.GoToRecord , , acLast
    DoCmd.GoToControl "SERIALNO"
    Clipboard.Clear
    
Exit_COPY_REC_Click:
    Exit Sub

Err_COPY_REC_Click:
    MsgBox err.Description
    Resume Exit_COPY_REC_Click
    
End Sub

But in both cases Access crashes to desktop without warning when the command button is clicked.
Am I missing something?

-Turb


- Turb
 
Golom
Clipboard Is A VB object not a VBA object
 
pwise,
Thank you for the heads-up.

Do you know if there is a way to programmatically clear the clipboard from Access? Or disable the message?




- Turb
 
try this

Code:
 Dim objie
 Set objie = CreateObject("InternetExplorer.Application")
 objie.Navigate ("about:blank")
 objie.Document.parentwindow.clipboardData.clearData
 objie.Quit
 
pwise,
Thank you again, but um... where do I place this please?


- Turb
 
place this code in module

Code:
Public Function ClearClipboard()

Dim objie
Set objie = CreateObject("InternetExplorer.Application")
objie.Navigate ("about:blank")
objie.Document.parentwindow.clipboardData.clearData
objie.Quit

End Function

Code:
Private Sub COPY_REC_Click()
On Error GoTo Err_COPY_REC_Click

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdPasteAppend
    ClearClipboard
    Me.SERIALNO = " "
    DoCmd.GoToRecord , , acLast
    DoCmd.GoToControl "SERIALNO"
    
    
Exit_COPY_REC_Click:
    Exit Sub

Err_COPY_REC_Click:
    MsgBox err.Description
    Resume Exit_COPY_REC_Click
    
End Sub
 
pwise

You're right. Sorry about that.

In a module
Code:
Public Declare Function EmptyClipboard Lib "user32" Alias "EmptyClipboard" () As Long
and in your code
Code:
Call EmptyClipBoard
 
Golom: Have A pink one for pointing me to a api this should faster than my approach
 
Golom, pwise,
Thank you both.

Golom, I created a new module called "MTClip" and placed your module code in it as written above.
Placed "EmptyClipBoard" just under "DoCmd.RunCommand acCmdPasteAppend" in my code...
No dice. Still getting the clipboard message.

So I then tried placing "Call EmptyClipBoard" into my code; same place...
Still getting the message.

I rechecked the code in "MTClip" and it seems Access has truncated the code to this when I saved the module?
Code:
Public Declare Function EmptyClipboard Lib "user32" () As Long


- Turb
 
Sorry ... not thinking noticibly well today ...

In a module
Code:
Declare Function CloseClipboard Lib "User32" () As Long
Declare Function OpenClipboard Lib "User32" (ByVal hwnd As Long) _
   As Long
Declare Function EmptyClipboard Lib "User32" () As Long

Public Sub ClearClipboard()
    Call OpenClipboard(0&)
    Call EmptyClipboard
    Call CloseClipboard
End Sub
Then in your code
Code:
ClearClipboard
 
YES! Thank you Golom! Here's another "pink one" for you my friend. :)


- Turb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top