Copying to clipboard...

  • Thread starter Thread starter Jordan
  • Start date Start date
J

Jordan

Guest
Hi-ya people,

I am using Access 97 and need to automatically copy the contents of a field (when that field is mouse clicked)to the clipboard (so it can be taken to another application for the user to paste into), and I'm having trouble finding this code on the help files.

This field needs to be locked so users can't change the contents - but I know from experience that when copying contents of one field to another, an error occurs as the "Focus" cannot be assigned to a locked field.

Can somebody please help me get around this.

Thank you.

Jordan.
---x---
 
Rich,

I'm still stuck on the code I need to use to automatically send it to the clipboard though.

Cheers

Jordan.
---x---
 
Can you use SendKeys?

When someone clicks on the field, have the on click event code unlock the field, set the focus to the field (to highlight the text), sendkeys control+c to copy it to the clip board, move the focus, relock the field?

Doug.
 
It seems that Access does not directly support clipboard operations (without explicitly linking in an additional DLL). So, I have fallen back on the funky SendKeys approach. I use the following code, and it works fine on a locked field:

txtText.SetFocus
txtText.SelStart = 0
txtText.SelLength = Len(txtText)
SendKeys "%EC", True
txtText.SelLength = 0


[This message has been edited by AlanS (edited 08-16-2001).]
 

Users who are viewing this thread

Back
Top Bottom