Share via

CmdCopy

Anonymous
2015-06-19T09:53:38+00:00

Why would it tell me that this recordset is not updateable (error message) when I run the code below that is called from a form?  All I'm doing is navigating to a the "Account Number" control and coping the content.  Yet if I ask it to navigate to another control on the same form and copy, no problem.  Is it because I'm asking it to navigate to the same control that I click on to run the copy code?  Meaning, that I want to click the Account Number control and copy the number.  I do this SO much throughout the day that I'm get tired of right-clicking and selecting copy.  Just easier to click and move on.

Option Compare Database

Option Explicit

Public Function CopyAccountNumberDocumentCenter()

DoCmd.GoToControl "Account Number"

DoCmd.RunCommand acCmdCopy

End Function

Thank you for the help in advance.

Ken

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

ScottGem 68,830 Reputation points Volunteer Moderator
2015-06-19T17:11:00+00:00

OK, so the ultimate goal is to use the Account Number field to generate an e-mail address, correct?

So, is the code to do the e-mail on the same form? If so, you can just reference the control name in the code. If its not, then use Forms!formname![Account Number] to reference it. Like I sad use value assignments instead of copy and paste.

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2015-06-19T14:08:02+00:00

    When we ask the Recordsource we want to see the SQL statement.

    What is it you are trying to accomplish here? I've never used acCmdCopy. If I want to copy a value I'll do an assignment:

    variable = Me.x

    Me.y = variable.

    What I need is this: click on the account number field in the form which copies the number.  As noted above, this saves me from right-clicking on the account number and selecting copy.  When you do this hundreds of times a day, it makes a big difference.

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-06-19T14:00:16+00:00

    When we ask the Recordsource we want to see the SQL statement.

    What is it you are trying to accomplish here? I've never used acCmdCopy. If I want to copy a value I'll do an assignment:

    variable = Me.x

    Me.y = variable.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-06-19T13:42:00+00:00

    What is the Recordsource of the form?

    A query.  If I place the copy code above in a differen control, it WILL copy the account number.  It's only when placed within the account number control --- the info that needs to be copied.

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2015-06-19T12:11:23+00:00

    What is the Recordsource of the form?

    Was this answer helpful?

    0 comments No comments