Copy one record to the same table in MS Access copies only first 5 fields.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zimectrin
    New Member
    • Mar 2010
    • 1

    #1

    Copy one record to the same table in MS Access copies only first 5 fields.

    Found this code on this site. It seems to work except for one problem. Only the first five of 20 fields are copied. I have done my due diligence to find some reason for this behavior, but now am appealing to any of you to point me in the right direction.

    Some information:
    Access 2007
    Form where button located is based on a simple query.
    There are no error messages, just when I look at the table only the first five fields have data in them, rest are blank.
    Last populated field is text. (City Name)
    First bland field is text. (State)
    Copy and Paste are to same table.

    Have spent hours on this, looking for some difference in the field properties, etc. Thank all of you in advance for any help. Maybe someday will be able to pay it forward.

    Code:
     Private Sub cmdDuplicate_Click()
     On Error GoTo Err_cmdDuplicate_Click
      
      
         DoCmd.RunCommand acCmdSelectRecord
         DoCmd.RunCommand acCmdCopy
         DoCmd.RunCommand acCmdRecordsGoToNew
         DoCmd.RunCommand acCmdSelectRecord
         DoCmd.RunCommand acCmdPaste
      
     Exit_cmdDuplicate_Click:
         Exit Sub
      
     Err_cmdDuplicate_Click:
         MsgBox Err.Description
         Resume Exit_cmdDuplicate_Click
      
     End Sub
    Last edited by Frinavale; Mar 29 '10, 03:42 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
Working...