Results 1 to 8 of 8
  1. #1
    rmceu1 is offline Novice
    Windows 10 Office 365
    Join Date
    Aug 2021
    Posts
    5

    Copy/Paste in Table view works but in Form View does not

    I have a form with a single table as its record source. The form has both bound and unbound controls, and the form view is Single Form.



    If in Form view I select a record and copy (using CTRL+C), then go to a new record and paste (CTRL+V), I get an error saying the field's not big enough for the data I'm trying to paste and to try pasting less. There is also a "Paste Errors" table created with the data of the record I copied. This same behavior is happening in code with the acCmdSelectRecord/acCmdCopy/acCmdPasteAppend command construct. However, if I open the table itself and manually copy/paste the same record, it is successfully appended to the table (with a new autonumber value for the primary key, of course).

    Since I know the values in the bound controls are valid (because the record being copied is already on the table with all valid field values), I'm focused on the unbound controls. So a couple of general questions:


    1. Is this "field is too small" error a common issue that I've somehow missed all these years?
    2. Any suggestions or recommendation on how I would go about determining which of the unbound controls is the culprit?

  2. #2
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    You cannot Paste a record into a Single Form

    You can Paste specific data into 1 field.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if you want to paste an entire record, use an append query.

  4. #4
    rmceu1 is offline Novice
    Windows 10 Office 365
    Join Date
    Aug 2021
    Posts
    5
    Thank you both for your responses.

    @mike60smart Unless we're using different terminology, I'm afraid I must disagree with your statement. You certainly can Paste a record into a Single Form (provided the form's Allow Additions property is set to Yes) by selecting the current record and copying, then clicking new record and pasting.

    @ranman256 I understand that I could use an append query, but my goal is to create the new record and then navigate the user to the new record. With an append query, I don't know the new primary key value after the query is run in order to navigate the user to that record. I know I can add via recordset, then set the recordset bookmark to rs.LastModified to retrieve this value - and that's probably the approach I'll end up taking. But I think the native copy/paste functionality would be more straight-forward, if I could just figure out this "field is too small" error on one of the unbound controls.

    Any other thoughts/input would be most welcome! Thanks.

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    With an append query, I don't know the new primary key value after the query is run in order to navigate the user to that record
    If the autonumber ID field is not bound, DMax will tell you that. If it is, Me.nameOfIDfield will tell you that assuming you're on the newly saved record. IMO the append query approach is the way to go.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Is the record selector visible? And do you click on it before pasting?

  7. #7
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by CJ_London View Post
    Is the record selector visible? And do you click on it before pasting?
    I did. However, when trying to navigate off of the record I got a complaint about missing fields, which is odd given that it should not be possible for the copied record to have no data in the required fields. The whole idea of copying and pasting records that way is too wonky for my liking.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I don't know the new primary key value after the query is run in order to navigate the user to that record.
    easy enough to find it

    Code:
    dim db as dao.database
    dim newPK as long
    
    set db=currentdb
    db.execute("INSERT INTO....")
    newPK= db.OpenRecordset("SELECT @@Identity")(0)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-16-2019, 11:16 AM
  2. Replies: 10
    Last Post: 02-06-2018, 02:37 PM
  3. Replies: 9
    Last Post: 07-15-2015, 02:38 AM
  4. Replies: 2
    Last Post: 03-09-2014, 03:21 PM
  5. Replies: 1
    Last Post: 12-18-2011, 01:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums