Full Version: Copying info to your clipboard using VBA...
UtterAccess Discussion Forums > Microsoft® Access > Access Modules
JabbaTheHutt
HI!

OK, let's say there's a form with a text box that is Enabled=False, Locked=True so the users can see it, but not click in it andmonkey with it.

I want to be able to add a button to the form where a user can click the button and then have the contents of the above mentioned text box in thier clipboard so they can paste it into an email or whatever.

what would the code the for on click event of the button be?

Thanks
Bob_L
One simple one is just

CODE
Me.YourTextBoxField.Locked = False
Me.YourTextBoxField.SetFocus
DoCmd.Copy
Me.AnotherControlToSetFocusTo.SetFocus
Me.YourTextboxField.Locked = True
niesz
Try:

Me.Text0.Enabled = True
Me.Text0.SetFocus
DoCmd.RunCommand acCmdCopy
Screen.PreviousControl.SetFocus
Me.Text0.Enabled = False

You may also want to check out:
http://www.mvps.org/access/api/api0049.htm
JabbaTheHutt
thanks to both.
niesz
thumbup.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.