Copy field text to clipboard error

randle

Registered User.
Local time
Today, 18:31
Joined
Jun 16, 2010
Messages
57
Hi,

I have a form with two Text box fields "Username" & "Password"

I want to create a copy button next to each field that will copy the contents to the clipboard.

The password field has the code:
Code:
Private Sub Command228_Click()
    Me!Password.SetFocus
    DoCmd.RunCommand acCmdCopy
End Sub

The username field has the code:
Code:
Private Sub Command229_Click()
    Me!Username.SetFocus
    DoCmd.RunCommand acCmdCopy
End Sub

The Username copy button for some reason gives me the following error:
Run-time error '438': Object doesn't support this property or method

Any ideas why it doesn't like this field?
 
Is Username control placed on the Form you are referring to? If you do not get what I mean, change Me! to Me. and start typing Username, if it does not get listed in the list then you do not have the Username control, you have the Recorsdsource to include the Username Feild not the Control.. Only controls have the property .SetFocus.
 
Hi Paul,

Yes it is a control as "Username" appears when completing the above however "user_name" also appeared and have tried this with success. Not sure where this has come from as the field doesn't have the underscore present anywhere I can see!!

Thanks for the help regardless
 
So are you sure it is not a Lable? Try deleting the control, add a new control from the Form design, link the Control Source again, rename the control as something different, then try it again..
 
No, it's definitely a Text Box control. Not to worry though as is working fine at the moment. If it does start failing I'll look at re-adding it as you suggest.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom